blog: add a blog section with a post template and listing page
Also added a sample post documents every element and sets its index teaser with a more marker
Pedro Lucas Porcellis porcellis@eletrotupi.com · 1 month ago
c127a41a5c98e8fc51bad450b54afda15e4ba6bb Browse filesParents
00a028bChanged files
6
Additions
+218
Deletions
-3
assets/main.scss
1 1
@import 'fonts.scss';
2 2
3 3
$font-size-2: 19px;
4 4
5 5
$landing-size-value: 2.2;
176 176
// html:not([data-theme="light"]) .logo-type {
177 177
// filter: brightness(1.5);
178 178
// }
179 179
//}
180 180
181 +
html[data-theme="dark"] main .highlight pre {
182 +
background: var(--color-code-bg) !important;
183 +
}
184 +
185 +
@media (prefers-color-scheme: dark) {
186 +
html:not([data-theme="light"]) main .highlight pre {
187 +
background: var(--color-code-bg) !important;
188 +
}
189 +
}
190 +
181 191
.fine-line {
182 192
color: var(--color-faint);
183 193
}
184 194
185 195
footer {
197 207
}
198 208
199 209
a {
200 210
color: var(--color-muted);
201 211
}
212 +
}
213 +
214 +
main {
215 +
h1,
216 +
h2,
217 +
h3,
218 +
h4 {
219 +
line-height: 1.2;
220 +
}
221 +
222 +
h1 {
223 +
font-size: 2.1rem;
224 +
}
225 +
226 +
h2 {
227 +
margin-top: 2.5rem;
228 +
font-size: 1.4rem;
229 +
}
230 +
231 +
h3 {
232 +
margin-top: 2rem;
233 +
font-size: 1.15rem;
234 +
}
235 +
236 +
p,
237 +
ul,
238 +
ol,
239 +
blockquote {
240 +
margin: 1rem 0;
241 +
}
242 +
243 +
ul,
244 +
ol {
245 +
padding-left: 1.5rem;
246 +
}
247 +
248 +
blockquote {
249 +
margin-left: 0;
250 +
padding-left: 1rem;
251 +
border-left: 3px solid var(--color-accent);
252 +
color: var(--color-muted);
253 +
}
254 +
255 +
img {
256 +
max-width: 100%;
257 +
height: auto;
258 +
}
259 +
260 +
hr {
261 +
margin: 2rem 0;
262 +
border: 0;
263 +
border-top: 1px solid var(--color-rule);
264 +
}
265 +
266 +
code {
267 +
padding: 0.1em 0.3em;
268 +
border-radius: 3px;
269 +
background: var(--color-code-bg);
270 +
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
271 +
font-size: 0.85em;
272 +
}
273 +
274 +
pre {
275 +
padding: 1rem;
276 +
overflow-x: auto;
277 +
border-radius: 4px;
278 +
background: var(--color-code-bg);
279 +
280 +
code {
281 +
padding: 0;
282 +
background: none;
283 +
font-size: 0.8rem;
284 +
}
285 +
}
286 +
287 +
table {
288 +
width: 100%;
289 +
margin: 1.5rem 0;
290 +
border-collapse: collapse;
291 +
}
292 +
293 +
th,
294 +
td {
295 +
padding: 0.4rem 0.6rem;
296 +
border: 1px solid var(--color-rule);
297 +
text-align: left;
298 +
}
299 +
300 +
th {
301 +
background: var(--color-code-bg);
302 +
}
303 +
}
304 +
305 +
.post-meta {
306 +
color: var(--color-muted);
307 +
font-family: sans-serif;
308 +
font-size: 0.8rem;
202 309
}
203 310
204 311
.landing p {
205 312
font-style: normal;
206 313
font-size: calc(calc(#{$landing-size-value} - 1) * calc(.012 * min(100vh, 900px)) + 1rem);
223 330
224 331
header .theme-toggle {
225 332
margin-left: auto;
226 333
}
227 334
}
/dev/null → content/posts/_index.md
1 +
+++
2 +
title = 'Blog'
3 +
description = 'Notes, experiments and things we learn while building software.'
4 +
+++
/dev/null → content/posts/post-template.md
1 +
+++
2 +
title = 'Post template'
3 +
date = 2026-10-24
4 +
description = 'A reference post covering the Markdown elements available on the blog.'
5 +
draft = false
6 +
# tags = ['hugo', 'reference']
7 +
# summary = 'Set a custom summary here, otherwise Hugo uses the first paragraph.'
8 +
+++
9 +
10 +
This is a reference post for the elements used on the blog. Replace this
11 +
paragraph with the actual introduction.
12 +
13 +
<!--more-->
14 +
15 +
## A section heading
16 +
17 +
A regular paragraph with **bold text**, *italic text*, `inline code`, and a
18 +
[link to the Hugo documentation](https://gohugo.io/).
19 +
20 +
### A smaller heading
21 +
22 +
- First item
23 +
- Second item
24 +
- Nested item
25 +
- Third item
26 +
27 +
1. First step
28 +
2. Second step
29 +
3. Third step
30 +
31 +
> A blockquote for pulling out a sentence that matters.
32 +
33 +
## Code
34 +
35 +
A shell example:
36 +
37 +
```bash
38 +
hugo server --buildDrafts
39 +
```
40 +
41 +
A Go example:
42 +
43 +
```go
44 +
package main
45 +
46 +
import "fmt"
47 +
48 +
func main() {
49 +
fmt.Println("hello, cabotiá")
50 +
}
51 +
```
52 +
53 +
## Table
54 +
55 +
| Element | Purpose |
56 +
| -------- | -------------------------------- |
57 +
| Heading | Break the post into sections |
58 +
| List | Group related items |
59 +
| Code | Show commands or snippets |
60 +
| Quote | Highlight a single sentence |
61 +
62 +
## Image
63 +
64 +

65 +
66 +
## Closing
67 +
68 +
That is the whole template. Copy this file, change the front matter, and
69 +
replace the body with the actual post.
70 +
71 +
The `<!--more-->` marker above the first heading sets the teaser shown on the
72 +
blog index. Without it, Hugo falls back to the first paragraphs or to the
73 +
`summary` value in the front matter.
layouts/_default/baseof.html
1 1
<!DOCTYPE html>
2 2
<html lang="{{ .Site.Language.Lang }}">
3 3
<head>
4 4
<meta charset="utf-8">
5 5
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6 -
<meta name="description" content="{{ .Summary | default .Params.summary }}">
6 +
<meta name="description" content="{{ .Description | default (.Summary | plainify) }}">
7 7
<meta name="color-scheme" content="light dark">
8 8
9 9
<title>{{ .Title }}</title>
10 10
11 11
<script>
113 113
sync();
114 114
})();
115 115
</script>
116 116
</body>
117 117
</html>
/dev/null → layouts/_default/list.html
1 +
{{ define "main" }}
2 +
<h1>{{ .Title }}</h1>
3 +
{{ .Content }}
4 +
5 +
{{ range .Pages.ByDate.Reverse }}
6 +
<article>
7 +
<h2>
8 +
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
9 +
</h2>
10 +
11 +
{{ if not .Date.IsZero }}
12 +
<p class="post-meta">
13 +
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2 January 2006" }}</time>
14 +
</p>
15 +
{{ end }}
16 +
17 +
{{ with .Summary }}
18 +
<p>{{ . | plainify | truncate 240 }}</p>
19 +
{{ end }}
20 +
</article>
21 +
{{ end }}
22 +
{{ end }}
layouts/_default/single.html
1 1
{{ define "main" }}
2 -
<h1>{{ .Title }}</h1>
3 -
{{ .Content }}
2 +
<article>
3 +
<h1>{{ .Title }}</h1>
4 +
5 +
{{ if not .Date.IsZero }}
6 +
<p class="post-meta">
7 +
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2 January 2006" }}</time>
8 +
</p>
9 +
{{ end }}
10 +
11 +
{{ .Content }}
12 +
</article>
4 13
{{ end }}