Skip to content

Commit 36d441f

Browse files
authored
Feature/tips (#128)
* ✨ Feat(tips): init tips section * πŸ’„ UI(tips): improve style * ✨ Feat(tips): improve style, add some tips * πŸ’„ UI(tips): update style to dark mode * Feat(tips): add new audit tip * ✨ Feat(tips): handle tips tags
1 parent 887ea9b commit 36d441f

File tree

17 files changed

+460
-45
lines changed

17 files changed

+460
-45
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: easy window resize
3+
author: tmaillard
4+
date: 2024-05-24
5+
expirydate: ""
6+
draft: false
7+
tipstags:
8+
- chrome
9+
---
10+
Un plugin pour retailler rapidement sa fenΓͺtre chrome, toujours utile quand on fait du dΓ©v front !
11+
12+
[https://chromewebstore.google.com/detail/easy-window-resize](https://chromewebstore.google.com/detail/easy-window-resize/cfpenpohaapdgnkglcbgjiooipcbcebi?pli=1)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Faire des commits conventionnels
3+
author: mbollot
4+
date: 2024-05-24
5+
expirydate: ""
6+
draft: false
7+
---
8+
commitizen est un outil en ligne de commande pour faire des commit, quand on le lance il demande si c'est une feature, un bug etc. quelle catΓ©gorie est concernΓ©e, quel est le message de commit, si cela ferme un ticket… Bref quelques questions et il va crΓ©er un joli commit bien formatΓ©, avec un emoji.
9+
10+
<https://github.com/commitizen/cz-cli>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Faire un audit de sΓ©curitΓ©
3+
author: mbollot
4+
date: 2024-05-24
5+
expirydate: ""
6+
draft: false
7+
---
8+
Vous Γͺtes piratΓ© ! Ou au moins vous Γͺtes piratable ! Bon, peut-Γͺtre pas mais comment savoir sans faire un audit ? Alors c'est parti grΓ’ce Γ  [lynis](https://github.com/CISOfy/lynis). Lancez \`lynis audit system\` et regardez le rΓ©sultat. Disponible sur linux, macOS, BSD.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Mettre Γ  jour toutes les dΓ©pendances NPM
3+
author: mbollot
4+
date: 2024-05-23
5+
expirydate: ""
6+
draft: false
7+
tipstags:
8+
- npm
9+
---
10+
Un petit outil rapide pour mettre Γ  jour toutes les dΓ©pendances NPM d'un projet :
11+
12+
```
13+
npm install -g yarn-upgrade-all && yarn-upgrade-all
14+
```
15+
Il va supprimer et rΓ©installer tous les paquets du package.json donc avec des versions Γ  jour :)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: "only-allow : ne vous trompez plus"
3+
author: probillard
4+
date: 2024-05-24
5+
expirydate: ""
6+
draft: false
7+
tipstags:
8+
- npm
9+
- yarn
10+
---
11+
Γ‡a vous arrive de switcher de projet et de vous tromper entre npm et yarn ? Plus maintenant, grΓ’ce Γ  [only-allow](https://www.npmjs.com/package/only-allow) !
12+
13+
Ajoutez juste une commade en preinstall (plus d'info sur le readme) et c'est parti
14+
15+
```
16+
{
17+
"scripts": {
18+
"preinstall": "npx only-allow npm"
19+
}
20+
}
21+
```

β€Ž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/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
{{ partial "cloud" .}}
88
{{ partial "team" .}}
99
{{ partial "blog" .}}
10+
{{ partial "tips" .}}
1011

1112
{{ end }}

β€Žsite/layouts/partials/tips.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<section id="tips">
2+
<h1>Tips</h1>
3+
4+
<div class="wrapper">
5+
6+
{{ range first 3 (where .Site.RegularPages "Section" "tips") }}
7+
{{ .Render "li" }}
8+
{{ end }}
9+
</div>
10+
<div class="wrapper-center">
11+
<a href="/tips/" class="btn">Tous nos tips</a>
12+
</div>
13+
</section>

β€Žsite/layouts/tips/li.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{ $baseurl := .Site.BaseURL }}
2+
3+
<div class="tips-snippet-container">
4+
<div class="tips-snippet">
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+
<div class="content">
18+
{{ .Content }}
19+
</div>
20+
{{ if .Truncated }}
21+
<a aria-label="Voir tous les articles" class="read-more" href="{{ .Permalink }}">En savoir plus
22+
{{ partial "arrow_right.html" . }}
23+
</a>
24+
{{ end }}
25+
</div>
26+
</div>

β€Žsite/layouts/tips/list.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{ define "main" }}
2+
3+
<section id="tips">
4+
<h1>
5+
Tips
6+
</h1>
7+
8+
<div class="wrapper">
9+
{{ range $index, $page := .Paginator.Pages }}
10+
{{ .Render "li" }}
11+
{{ end }}
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 }}
29+
30+
</section>
31+
{{end}}

β€Žsite/layouts/tips/single.html

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{{ define "main" }}
2+
3+
<section id="tips">
4+
<div class="wrapper">
5+
<h1>
6+
Tips
7+
</h1>
8+
</div>
9+
10+
<section id="article">
11+
<div class="wrapper">
12+
<article>
13+
<div class="wrapper-content">
14+
<h2>{{ .Title }}</h2>
15+
{{if .Params.tags }}
16+
<ul class="tags">
17+
{{ range $index, $tag := .Params.tipstags }}
18+
<li><a href="/tipstags/{{ $tag | urlize }}/">{{ $tag }}</a></li>
19+
{{ end }}
20+
</ul>
21+
{{ end }}
22+
<div class="content">
23+
{{ .Content }}
24+
</div>
25+
<div class="content-footer">
26+
{{if .Params.tags }}
27+
<ul class="tags float">
28+
{{ range $index, $tag := .Params.tags }}
29+
<li><a href="/tipstags/{{ $tag | urlize }}/">{{ $tag }}</a></li>
30+
{{ end }}
31+
</ul>
32+
{{ end }}
33+
<section id="author">
34+
<div class="date">RΓ©digΓ© par <span class="author-name">{{ .Params.author}}</span></div>
35+
</section>
36+
</div>
37+
<div class="share">
38+
<span>Partager</span>
39+
<ul class="socials">
40+
<li>
41+
<a target="_blank" title="Facebook"
42+
href="https://www.facebook.com/sharer.php?u=http://code-troopers.com{{ .Permalink }}&t={{ .Title }}"
43+
class="facebook-button" rel="nofollow"
44+
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;">
45+
{{ partial "svg" "facebook-fill" }}
46+
</a>
47+
</li>
48+
<li>
49+
<a target="_blank" title="Twitter"
50+
href="https://twitter.com/share?url=http://code-troopers.com{{ .Permalink }}&text={{ .Title }}&via=codetroopers"
51+
rel="nofollow"
52+
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;">
53+
{{ partial "svg" "twitter-x-fill" }}
54+
</a>
55+
</li>
56+
</ul>
57+
</div>
58+
<div style="clear:both"></div>
59+
60+
61+
<div class="back">
62+
<div class="pagination black">
63+
{{ if .NextInSection }}
64+
<a href="{{ .NextInSection.Permalink }}" class="previous-page">
65+
<div class="arrow">{{ partial "arrow_left.html" . }}</div>
66+
Article prΓ©cΓ©dent
67+
</a>
68+
{{ end }}
69+
{{ if .PrevInSection }}
70+
<a href="{{ .PrevInSection.Permalink }}" class="next-page">
71+
Article suivant
72+
<div class="arrow">{{ partial "arrow_right.html" . }}</div>
73+
</a>
74+
{{ end }}
75+
</div>
76+
</div>
77+
78+
<section id="menu">
79+
<ul>
80+
{{ range $key, $taxonomy := .Site.Taxonomies.featured }}
81+
<li> {{ $key }}</li>
82+
<ul>
83+
{{ range $taxonomy.Pages }}
84+
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a></li>
85+
{{ end }}
86+
</ul>
87+
{{ end }}
88+
</ul>
89+
</section>
90+
91+
<div id="disqus_thread"></div>
92+
<script type="text/javascript">
93+
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
94+
var disqus_shortname = 'codetroopers' // required: replace example with your forum shortname
95+
var disqus_url = window.location.href
96+
if (window.location.protocol != 'http:') {
97+
disqus_url = 'http:' + window.location.href.substring(window.location.protocol.length)
98+
}
99+
100+
/* * * DON'T EDIT BELOW THIS LINE * * */
101+
(function () {
102+
var dsq = document.createElement('script')
103+
dsq.type = 'text/javascript'
104+
dsq.async = true
105+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
106+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq)
107+
})()
108+
</script>
109+
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments
110+
powered by Disqus.</a></noscript>
111+
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span
112+
class="logo-disqus">Disqus</span></a>
113+
</div>
114+
</article>
115+
</div>
116+
</section>
117+
</section>
118+
{{ end }}

β€Žsite/layouts/tipstags/li.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{ $baseurl := .Site.BaseURL }}
2+
3+
<div class="tips-snippet">
4+
<h2>
5+
{{ if .Truncated }}
6+
<a aria-label="En savoir plus sur {{ .Title }}" href="{{ .Permalink }}">{{ .Title }}</a>
7+
{{ else }}
8+
{{ .Title }}
9+
{{ 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 }}
18+
</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 }}
24+
</div>

β€Žsite/layouts/tipstags/list.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{ define "main" }}
2+
3+
<section id="tipstags">
4+
<h1>
5+
Tips
6+
</h1>
7+
8+
<div class="wrapper">
9+
{{ range $index, $page := .Paginator.Pages }}
10+
{{ .Render "li" }}
11+
{{ end }}
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 }}
29+
30+
</section>
31+
{{end}}

β€Žsite/static/admin/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ media_folder: "site/static/img" # Folder where user uploaded files should go
2222
public_folder: "img"
2323

2424
collections: # A list of collections the CMS should be able to edit
25+
- name: "tips" # Used in routes, ie.: /admin/collections/:slug/edit
26+
label: "Tips" # Used in the UI, ie.: "New Post"
27+
folder: "site/content/tips" # The path to the folder where the documents are stored
28+
media_folder: "."
29+
path: "{{slug}}/index" # Each document is inside a folder with the slug name.
30+
create: true # Allow users to create new documents in this collection
31+
fields: # The fields each document in this collection have
32+
- {label: "Title", name: "title", widget: "string"}
33+
- {label: "Author", name: "author", widget: "string"}
34+
- {label: "Publish Date", name: "date", widget: "datetime", format: "YYYY-MM-DD", timeFormat: false}
35+
- {label: "Expiry Date", name: "expirydate", widget: "datetime", format: "YYYY-MM-DD", timeFormat: false, required: false, default: ''}
36+
- {label: "Body", name: "body", widget: "markdown"}
37+
- {label: "Draft", name: "draft", widget: "boolean", default: true}
38+
- {label: "Tags", name: "tipstags", widget: "list"}
2539
- name: "post" # Used in routes, ie.: /admin/collections/:slug/edit
2640
label: "Post" # Used in the UI, ie.: "New Post"
2741
folder: "site/content/blog" # The path to the folder where the documents are stored

0 commit comments

Comments
Β (0)