Static blog site generator in one Go binary: Markdown in, self-contained semantic HTML out. No JavaScript, no database, minimal deps.

Can't get homcards and custom footer links to work #3

Closed 0x46.tngl.sh
Closed opened by 0x46.tngl.sh

I've git cloned git@tangled.org:janantos.tngl.sh/mfblog to get the latest iteration of mfblog and build the binary via: go build -o mfblog .. Afterwards I've created a new project via: mfblog createsite. Next I've updated the file config.json as follows:

Settings in config.json #

{
  "title": "Website Tile",
  "url": "https://example.com/",
  "description": "Website description",
  "author": "Frank",
  "lang": "de",
  "out": "out",
  "homePosts": 3,
  "homeCards": true,
  "feedPosts": 20,
  "footerLinks": [
    { "text": "Impressum", "href": "/impressum/" },
    { "text": "Datenschutz", "href": "/datenschutz/" }
  ]
}

and created a new blog post test-page via: mfblog create -dir my-website.

Next I've created the files datenschutz.md and impressum.md in mfblog/my-website/content and defined each frontmatter as follows:

Frontmatter of the file mfblog/my-website/content/impressum.md #

---
title: Impressum
type: page
description: Betreiberinformationen dieser Webseite
---

Frontmatter of the file mfblog/my-website/content/datenschutz.md #

---
title: Datenschutz
type: page
description: Datenschutzerklärung
---

Listing the directory content shows the following results:

Content in mfblog/my-website/content/ #

drwxr-xr-x 2 user user 4,0K Okt 28 10:42 img
-rw-r--r-- 1 user user  195 Okt 28 12:27 2026-10-28-hello-world.md
-rw-r--r-- 1 user user  131 Okt 28 12:39 2026-10-28-test-page.md
-rw-r--r-- 1 user user  18K Okt 28 12:39 datenschutz.md
-rw-r--r-- 1 user user  687 Okt 28 12:39 impressum.md
-rw-r--r-- 1 user user   72 Okt 28 10:42 index.md

Now when I serve or build and upload the website the generated data does neither show Impressum nor Datenschutz within footer. Instead this content is listed as regular blog posts.

The setting type: page within each pages frontmatter should do the trick but it doesn't. Which setting did I miss or have done wrong? Also blog posts are listed as regular links instead of cards - my setting is specified as follows: "homeCards": true,.

Ok let me reproduce it, I will investigate

HI, I have tried to reproduce, and it works for me, are you sure you dont have somewhere in higher priority path older version of mfblog binary? try which mfblog here is reproduced dir structure

.
├── config.json
├── content
│   ├── 2026-10-28-hello-world.md
│   ├── 2026-10-28-second-post.md
│   ├── datenschutz.md
│   ├── img
│   ├── impressum.md
│   └── index.md
└── static

config.json

{
  "title": "testsite",
  "url": "http://localhost:8080",
  "description": "test site",
  "author": "Jan Antos",
  "lang": "en",
  "out": "out",
  "homePosts": 3,
  "homeCards": true,
  "feedPosts": 20,
  "footerLinks": [
    { "text": "Impressum", "href": "/impressum/" },
    { "text": "Datenschutz", "href": "/datenschutz/" }
  ]
}

impressum.md

---
title: Impressum
type: page
description: Betreiberinformationen dieser Webseite
---

impressum blablabla

datenschutz.md

---
title: Datenschutz
type: page
description: Datenschutzerklärung
---

datenschutz blablabla

Okay, I cloned this repository a little too early; some updates were still missing. Now everything works as expected—thank you very much for the new features, which I really appreciate!

If you have some ideas shoot on me 😉 glad it also serves to someone else than me.

So far I was thinking about optional images in post cards in home view.

This idea sounds interesting, even though I don't have a use for it right now. Localization could be a thing if more people will use mfblog.

I've adapted my version of mfblog linguistically so that some sections have been localized into German. This applies to the sections <title>, <nav> and <footer>.

The changes I made are as follows:

Updated sections in internal/build/site.go

diff --git a/internal/build/site.go b/internal/build/site.go
index 22e320c..52c95d2 100644
--- a/internal/build/site.go
+++ b/internal/build/site.go
@@ -324,7 +324,7 @@ func (s *Site) IndexPage() (string, error) {
 			shown = shown[:limit]
 		}
 		b.WriteString(`<section id="posts">
-<h2>Posts</h2>
+<h2>Letzte Beiträge</h2>
 `)
 		if s.Cfg.HomeCards {
 			b.WriteString(s.homePostCardsHTML(shown))
@@ -339,7 +339,7 @@ func (s *Site) IndexPage() (string, error) {
 			b.WriteString("</ul>\n")
 		}
 		if len(s.Posts) > limit {
-			b.WriteString("<p><a href=\"" + s.href("/archive/") + "\">All posts (" + strconv.Itoa(len(s.Posts)) + ") &rarr;</a></p>\n")
+			b.WriteString("<p><a href=\"" + s.href("/archive/") + "\">Alle Beiträge (" + strconv.Itoa(len(s.Posts)) + ") &rarr;</a></p>\n")
 		}
 		b.WriteString("</section>\n")
 	}
@@ -383,7 +383,7 @@ func (s *Site) homePostCardsHTML(posts []*post.Post) string {
 // first, with a small year nav when the archive spans several years.
 func (s *Site) ArchivePage() (string, error) {
 	var b strings.Builder
-	b.WriteString("<h1>Archive</h1>\n")
+	b.WriteString("<h1>Archiv</h1>\n")
 	if len(s.Posts) == 0 {
 		b.WriteString("<p>No posts yet.</p>\n")
 	} else {
@@ -417,7 +417,7 @@ func (s *Site) ArchivePage() (string, error) {
 	}
 	return tmpl.Render(tmpl.Page{
 		Site:      s.Cfg,
-		Title:     "Archive — " + s.Cfg.Title,
+		Title:     "Archiv — " + s.Cfg.Title,
 		Desc:      s.Cfg.Description,
 		Canonical: s.Cfg.URL + "/archive/",
 		OGType:    "website",

Updated sections in internal/tmpl/tmpl.go

diff --git a/internal/tmpl/tmpl.go b/internal/tmpl/tmpl.go
index 18ceae1..8919f6e 100644
--- a/internal/tmpl/tmpl.go
+++ b/internal/tmpl/tmpl.go
@@ -116,17 +116,17 @@ const pageHTML = `<!doctype html>
 <header>
 <a class="brand" href="{{.Site.BasePath}}/">{{.Site.Title}}</a>
 <nav>
-  <a href="{{.Site.BasePath}}/#posts">Posts</a>
-  <a href="{{.Site.BasePath}}/archive/">Archive</a>
+  <a href="{{.Site.BasePath}}/#posts">Beitr&aumlge</a>
+  <a href="{{.Site.BasePath}}/archive/">Archiv</a>
   <a href="{{.Site.BasePath}}/tags/">Tags</a>
-  <label for="theme-switch" class="switch-label" title="Switch color theme"></label>
+  <label for="theme-switch" class="switch-label" title="Theme umschalten"></label>
 </nav>
 </header>
 <main>
 {{.Body}}
 </main>
 <footer>
-<p>{{.Year}}{{with .Site.Author}} &middot; {{.}}{{end}} &middot; <a href="{{.Site.BasePath}}/">home</a>{{with .FooterLinks}} &middot; {{.}}{{end}}</p>
+<p>{{.Year}}{{with .Site.Author}} &middot; {{.}}{{end}} &middot; <a href="{{.Site.BasePath}}/">Home</a>{{with .FooterLinks}} &middot; {{.}}{{end}}</p>
 </footer>
 </body>
 </html>
Sign up or Sign in to add to the discussion.