Compare commits

...

3 Commits

Author SHA1 Message Date
5680cb604a chore: bump theme version
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2025-12-14 21:04:29 +01:00
daae005103 feat: Add note on adding notes ;) 2025-12-14 21:03:00 +01:00
3f29069c91 feat: Add notes as post type 2025-12-14 21:02:46 +01:00
5 changed files with 150 additions and 56 deletions

View File

@@ -42,15 +42,16 @@ preserveTaxonomyNames = true
oxitraffic_url = "https://traffic.hyteck.de/count.js" oxitraffic_url = "https://traffic.hyteck.de/count.js"
# Nav links in the side bar # Nav links in the side bar
[[menu.main]] [[menu.main]]
name = "Home" name = "Notes"
url = "/" url = "notes/"
weight = 1 weight = 1
[[menu.main]] [[menu.main]]
name = "Services" name = "Services"
url = "services/" url = "services/"
weight = 3 weight = 2
[[menu.main]] [[menu.main]]
name = "About" name = "About"

6
content/notes/_index.md Normal file
View File

@@ -0,0 +1,6 @@
---
title: "Notes"
---
My notes are mainly a store of information for my future self. Here you find titbits of information, small HowTos and
such. Do not expect the quality of a blogpost for these.

View File

@@ -0,0 +1,61 @@
---
title: "Adding another post type to Hugo"
date: 2025-12-14T7:30:00+02:00
draft: false
subtitle: "How I added notes as content type to hugo in addition to the standard posts and pages."
---
Notes are short posts that focus on a small bit of information. Other than my blogposts they do not try to give a
complete picture or a full explanation. They are more of a brain-dump of mine with a low bar of typing them out.
So how did I add them?
1. **Create a notes folder:** The folder in `content/notes` will hold the notes
2. **Add rendering template:** Hugo needs to know what to do here, so add a rendering template in
`layouts/notes/list.html`. A sample is provided below.
3. Add `content/notes/_index.md` with a short explanation of the
### Styling template
```html
{{ define "main" }}
<h1">Notes</h1>
<div>
{{ .Content }}
</div>
<ul>
{{ range .Pages.ByDate.Reverse }}
<li
">
<h2>
<a href="{{ .Permalink }} "> {{ .Title }} </a>
</h2>
<small">{{ .Date.Format "2006-01-02" }}</small>
{{ if .Params.subtitle }}
<p>{{ .Params.subtitle }}</p>
{{ end }}
</li>
{{ end }}
</ul>
{{ end }}
```
As you can see, I added an optional subtitel. They make it much easier to find a note that is interesting, but should
not be necessary to lower the bar for the author. Subtitles can be specified like this
```markdown
---
title: "Adding another post type to Hugo"
date: 2025-12-14T7:30:00+02:00
draft: false
subtitle: "How I added notes as content type to hugo in addition to the standard posts and pages."
---
Notes are short posts
```

26
layouts/notes/list.html Normal file
View File

@@ -0,0 +1,26 @@
{{ define "main" }}
<h1 style="color: whitesmoke">Notes</h1>
<div style="color: whitesmoke;">
{{ .Content }}
</div>
<ul style="list-style-type:none">
{{ if (.Pages.ByDate.Reverse) }}
{{ range .Pages.ByDate.Reverse }}
<li class="block">
<h2>
<a href="{{ .Permalink }} " style="color: whitesmoke;"> {{ .Title }} </a>
</h2>
<small style="color: whitesmoke;">{{ .Date.Format "2006-01-02" }}</small>
{{ if .Params.subtitle }}
<p style="color: whitesmoke">{{ .Params.subtitle }}</p>
{{ end }}
</li>
{{ end }}
{{ else }}
No notes found.
{{ end }}
</ul>
{{ end }}