Skip to content

Commit 398897a

Browse files
Merge pull request #12 from wiremock/featured-tab
Add Featured page + Improve Categories listing
2 parents 9d22781 + 47ac2b7 commit 398897a

File tree

8 files changed

+94
-11
lines changed

8 files changed

+94
-11
lines changed

content/how-to-contribute.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
---
2-
title: How to contribute
2+
title: Contribute!
33
description:
44
heading: How to edit and add new templates
5+
description: Add new templates
6+
# We add the page to the listing for better UX
7+
tags:
8+
- all
9+
- featured
10+
tags_weight: 999
11+
logoPath: "/images/add.svg"
512
---
613

714
## If you would like to contribute

data/navigation.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Shows the categories order for the navigation bar
2+
tags:
3+
- id: featured
4+
- id: all
5+
- id: wiremock
6+
display: "WireMock"
7+
- id: analytics
8+
- id: backend
9+
- id: cloud
10+
- id: collaboration
11+
- id: customer_relation
12+
- id: developer_tools
13+
- id: ecommerce
14+
display: "E-Commerce"
15+
- id: education
16+
- id: email
17+
- id: enterprise
18+
- id: entertainment
19+
- id: financial
20+
- id: forms
21+
- id: hosting
22+
- id: iot
23+
display: "Internet of Things"
24+
- id: location
25+
- id: machine_learning
26+
- id: marketing
27+
- id: media
28+
- id: messaging
29+
- id: monitoring
30+
- id: open_data
31+
display: "Open Data"
32+
- id: payment
33+
- id: search
34+
- id: security
35+
- id: social
36+
- id: storage
37+
- id: support
38+
- id: telecom
39+
- id: text
40+
- id: tools
41+
- id: transport

i18n/en.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ categories:
22
other: "Categories"
33
all:
44
other: "All"
5+
featured:
6+
other: "Featured"
57
back:
68
other: "Back"
79
description:
@@ -10,5 +12,3 @@ use_api:
1012
other: "Use this API in your project"
1113
how_use:
1214
other: "How to use ?"
13-
14-

layouts/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
<section class="px-6 sm:px-10 pt-14 lg:pt-24">
99
<div class="mx-auto max-w-md sm:max-w-3xl lg:max-w-7xl">
10+
<h1 class="text-2xl sm:text-3xl lg:text-4xl font-bold text-sky-990">Featured templates</h1>
11+
Select a category below to search for more templates
1012
<div class="flex flex-col lg:flex-row gap-8 lg:gap-10 mt-6">
1113
<div>
1214
{{ partial "nav-tags.html" . }}
1315
</div>
1416
<div class="flex-1">
15-
{{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }}
17+
{{ $paginator := .Paginate (where site.RegularPages "Params.tags" "intersect" (slice "featured") ) }}
1618
<div class="grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
1719
{{ range $paginator.Pages }}
1820
{{ partial "card-api.html" . }}

layouts/partials/card-api.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
{{ end }}
1313
</div>
1414
{{ end }}
15+
{{ if .Params.logoPath }}
16+
<div class="relative flex justify-center items-center mb-5">
17+
<div class="svg-logo border border-slate-200 p-2 rounded justify-center">
18+
<img src="{{ .Params.logoPath | relLangURL }}" width="82px" height="82px">
19+
</div>
20+
</div>
21+
{{ end }}
1522
<div class="relative text-center">
1623
<h3 class="text-xl font-medium break-words">{{ .Title }}</h3>
1724
{{ with .Params.description }}

layouts/partials/nav-tags.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,29 @@
2929
x-transition:leave-end="opacity-0 translate-y-1"
3030
@click.outside="dropdown = false"
3131
class="absolute z-10 top-12 min-w-[16rem] bg-white rounded-md shadow-xl hidden py-2.5">
32-
<a class="{{ if .IsHome }}text-sky-600{{ else }}text-slate-500{{ end }} hover:text-sky-600 block px-5 py-2" href="{{ "/" | relLangURL }}">{{ i18n "all" }}</a>
33-
{{ range site.Taxonomies.tags }}
32+
{{ range $.Site.Data.navigation.tags }}
33+
{{ $tagId := . }}
34+
{{ $tagDisplay := .display }}
35+
{{ range $taxonomyname, $taxonomy := $.Site.Taxonomies.tags }}
36+
{{ if eq $taxonomyname $tagId }}
37+
{{ $tagDisplay := default (strings.FirstUpper (replace .Page.Title "_" " ")) $tagDisplay }}
3438
<a class="{{ if eq .Page.Permalink $.Permalink }}text-sky-600{{ else }}text-slate-500{{ end }} hover:text-sky-600 block px-5 py-2" href="{{ .Page.Permalink }}">{{ strings.FirstUpper (replace .Page.Title "_" " ") }}</a>
39+
{{ end }}
3540
{{ end }}
41+
{{ end }}
3642
</div>
3743
</div>
3844
<div class="hidden lg:flex -mt-2">
3945
<div class="flex flex-col">
40-
<a class="{{ if .IsHome }}text-sky-600 underline underline-offset-4 decoration-sky-600{{ else }}text-slate-500{{ end }} py-1.5 text-lg hover:text-sky-600" href="{{ "/" | relLangURL }}">{{ i18n "all" }}</a>
41-
{{ range site.Taxonomies.tags }}
42-
<a class="{{ if eq .Page.Permalink $.Permalink }}text-sky-600 underline underline-offset-4 decoration-sky-600{{ else }}text-slate-500{{ end }} py-1.5 text-lg hover:text-sky-600 whitespace-nowrap" href="{{ .Page.Permalink }}">{{ strings.FirstUpper (replace .Page.Title "_" " ") }}</a>
46+
{{ range $.Site.Data.navigation.tags }}
47+
{{ $tagId := .id }}
48+
{{ $tagDisplay := .display }}
49+
{{ range $taxonomyname, $taxonomy := $.Site.Taxonomies.tags }}
50+
{{ if eq $taxonomyname $tagId }}
51+
{{ $tagDisplay := default (strings.FirstUpper (replace .Page.Title "_" " ")) $tagDisplay }}
52+
<a class="{{ if eq .Page.Permalink $.Permalink }}text-sky-600 underline underline-offset-4 decoration-sky-600{{ else }}text-slate-500{{ end }} py-1.5 text-lg hover:text-sky-600 whitespace-nowrap" href="{{ .Page.Permalink }}">{{ $tagDisplay }}</a>
53+
{{ end }}
54+
{{ end }}
4355
{{ end }}
4456
</div>
4557
</div>

layouts/taxonomy/tag.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ <h1 class="text-2xl sm:text-3xl lg:text-4xl font-bold text-sky-990">{{ strings.F
88
</div>
99
<div class="flex-1">
1010
<div class="grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
11-
{{ range .Paginator.Pages }}
12-
{{ partial "card-api.html" . }}
11+
{{ if in .Permalink "/all" }}
12+
{{ $allTemplates := .Paginate ( where site.RegularPages "Params.stubs" "!=" nil ) }}
13+
{{ range $allTemplates.Pages }}
14+
{{ partial "card-api.html" . }}
15+
{{ end }}
16+
{{ else }}
17+
{{ range .Paginator.Pages }}
18+
{{ partial "card-api.html" . }}
19+
{{ end }}
1320
{{ end }}
1421
</div>
1522
<div class="mt-10">

static/images/add.svg

Lines changed: 7 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)