Skip to content

Commit 7fc7ece

Browse files
committed
✨ Feat(tips): handle tips tags
1 parent 47c23a8 commit 7fc7ece

File tree

11 files changed

+98
-55
lines changed

11 files changed

+98
-55
lines changed

site/content/tips/easy-window-resize/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: tmaillard
44
date: 2024-05-24
55
expirydate: ""
66
draft: false
7-
tags:
7+
tipstags:
88
- chrome
99
---
1010
Un plugin pour retailler rapidement sa fenêtre chrome, toujours utile quand on fait du dév front !

site/content/tips/mettre-à-jour-toutes-les-dépendances-npm/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: mbollot
44
date: 2024-05-23
55
expirydate: ""
66
draft: false
7-
tags:
7+
tipstags:
88
- npm
99
---
1010
Un petit outil rapide pour mettre à jour toutes les dépendances NPM d'un projet :

site/content/tips/only-allow-ne-vous-trompez-plus/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: probillard
44
date: 2024-05-24
55
expirydate: ""
66
draft: false
7-
tags:
7+
tipstags:
88
- npm
99
- yarn
1010
---

site/hugo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,11 @@ images = ["img/logo-code-troopers-tête-couleur.png"]
2828
[markup.goldmark]
2929

3030
[markup.goldmark.renderer]
31-
unsafe = true
31+
unsafe = true
32+
33+
[taxonomies]
34+
category = 'categories'
35+
series = 'series'
36+
tag = 'tags'
37+
tipstag = 'tipstags'
38+

site/layouts/tags/list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{ define "main" }}
22

3-
<section id="tips">
3+
<section id="blogs">
44
<div class="wrapper">
55
<h1>
6-
Tags
6+
Blog
77
</h1>
88
</div>
99

site/layouts/tips/list.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{{ define "main" }}
22

3-
{{ $paginator := .Paginate (where .Pages "Type" "blog") 8 }}
43
<section id="tips">
54
<h1>
65
Tips
76
</h1>
87

98
<div class="wrapper">
109
{{ range $index, $page := .Paginator.Pages }}
11-
{{ .Render "li" }}
10+
{{ .Render "li" }}
1211
{{ end }}
1312
</div>
1413
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}

site/layouts/tipstags/li.html

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{{ $baseurl := .Site.BaseURL }}
22

3-
<div>
4-
<div>
5-
<h2>
6-
{{ if .Truncated }}
7-
<a aria-label="En savoir plus sur {{ .Title }}" href="{{ .Permalink }}">{{ .Title }}</a>
8-
{{ else }}
9-
{{ .Title }}
10-
{{ end }}
11-
</h2>
12-
<ul class="tags">
13-
{{ range $index, $tag := .Params.tags }}
14-
<li><a aria-label="Tag {{ $tag }}" href="/tipstags/{{ $tag | urlize }}/">{{ $tag }}</a></li>
15-
{{ end }}
16-
</ul>
17-
<p>{{ .Summary | truncate 100 }}</p>
3+
<div class="tips-snippet">
4+
<h2>
185
{{ if .Truncated }}
19-
<a aria-label="Voir tous les articles" class="read-more" href="{{ .Permalink }}">En savoir plus
20-
{{ partial "arrow_right.html" . }}
21-
</a>
6+
<a aria-label="En savoir plus sur {{ .Title }}" href="{{ .Permalink }}">{{ .Title }}</a>
7+
{{ else }}
8+
{{ .Title }}
229
{{ end }}
10+
</h2>
11+
<ul class="tags">
12+
{{ range $index, $tag := .Params.tags }}
13+
<li><a aria-label="Tag {{ $tag }}" href="/tipstags/{{ $tag | urlize }}/">{{ $tag }}</a></li>
14+
{{ end }}
15+
</ul>
16+
<div class="content">
17+
{{ .Content }}
2318
</div>
19+
{{ if .Truncated }}
20+
<a aria-label="Voir tous les articles" class="read-more" href="{{ .Permalink }}">En savoir plus
21+
{{ partial "arrow_right.html" . }}
22+
</a>
23+
{{ end }}
2424
</div>

site/layouts/tipstags/list.html

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
11
{{ define "main" }}
22

3-
{{ $paginator := .Paginate (where .Pages "Type" "tips") 8 }}
4-
<section id="tips">
5-
<div class="wrapper">
6-
<h1>
7-
Tips
8-
</h1>
9-
</div>
3+
<section id="tipstags">
4+
<h1>
5+
Tips
6+
</h1>
107

11-
<section id="articles">
12-
<div class="wrapper">
13-
{{ range $index, $page := .Paginator.Pages }}
8+
<div class="wrapper">
9+
{{ range $index, $page := .Paginator.Pages }}
1410
{{ .Render "li" }}
15-
{{ end }}
16-
</div>
17-
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
18-
<div class="pagination">
19-
{{ if .Paginator.HasPrev }}
20-
<a href="{{ .Paginator.Prev.URL }}" class="previous-page">
21-
<div class="arrow">{{ partial "arrow_left.html" . }}</div>
22-
Page précédente
23-
</a>
24-
{{ end }}
25-
{{ if .Paginator.HasNext }}
26-
<a href="{{ .Paginator.Next.URL }}" class="next-page">
27-
Page suivante
28-
<div class="arrow">{{ partial "arrow_right.html" . }}</div>
29-
</a>
30-
{{ end }}
31-
</div>
3211
{{ end }}
33-
</section>
12+
</div>
13+
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
14+
<div class="pagination">
15+
{{ if .Paginator.HasPrev }}
16+
<a href="{{ .Paginator.Prev.URL }}" class="previous-page">
17+
<div class="arrow">{{ partial "arrow_left.html" . }}</div>
18+
Page précédente
19+
</a>
20+
{{ end }}
21+
{{ if .Paginator.HasNext }}
22+
<a href="{{ .Paginator.Next.URL }}" class="next-page">
23+
Page suivante
24+
<div class="arrow">{{ partial "arrow_right.html" . }}</div>
25+
</a>
26+
{{ end }}
27+
</div>
28+
{{ end }}
3429

3530
</section>
3631
{{end}}

site/static/admin/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ collections: # A list of collections the CMS should be able to edit
3535
- {label: "Expiry Date", name: "expirydate", widget: "datetime", format: "YYYY-MM-DD", timeFormat: false, required: false, default: ''}
3636
- {label: "Body", name: "body", widget: "markdown"}
3737
- {label: "Draft", name: "draft", widget: "boolean", default: true}
38-
- {label: "Tags", name: "tags", widget: "list"}
38+
- {label: "Tags", name: "tipstags", widget: "list"}
3939
- name: "post" # Used in routes, ie.: /admin/collections/:slug/edit
4040
label: "Post" # Used in the UI, ie.: "New Post"
4141
folder: "site/content/blog" # The path to the folder where the documents are stored

src/css/_tipstags.scss

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
section#tipstags {
2+
background: $darkGradient;
3+
color: $white;
4+
padding-bottom: 50px;
5+
6+
.wrapper {
7+
max-width: 992px;
8+
margin: 0 auto;
9+
}
10+
11+
.tips-snippet {
12+
min-height: 200px;
13+
display: flex;
14+
flex-direction: column;
15+
justify-content: space-between;
16+
17+
width: 100%;
18+
padding: 35px;
19+
margin-top: 20px;
20+
margin-bottom: 20px;
21+
22+
border: 1px solid rgba($lightblue, 0.25);
23+
border-radius: 20px;
24+
background-color: rgba($darkerblue, 0.66);
25+
box-shadow: 0 0 10px 1px rgba($lightblue, 0.25);
26+
27+
backdrop-filter: blur(15px);
28+
29+
a {
30+
color: $nyanza;
31+
text-decoration: underline;
32+
&:hover {
33+
color: $lightblue;
34+
}
35+
}
36+
37+
h2 {
38+
margin: 0;
39+
}
40+
}
41+
}

src/css/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@import "navig";
2323
@import "team";
2424
@import "tips";
25+
@import "tipstags";
2526

2627
:root {
2728
scroll-behavior: smooth;

0 commit comments

Comments
 (0)