Compare commits
3 Commits
0216cd961a
...
5680cb604a
| Author | SHA1 | Date | |
|---|---|---|---|
| 5680cb604a | |||
| daae005103 | |||
| 3f29069c91 |
@@ -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
6
content/notes/_index.md
Normal 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.
|
||||||
61
content/notes/adding-post-type-hugo.md
Normal file
61
content/notes/adding-post-type-hugo.md
Normal 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
26
layouts/notes/list.html
Normal 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 }}
|
||||||
Submodule themes/hugo-nederburg-theme updated: d9d1250a46...76bdd0605d
Reference in New Issue
Block a user