Test Meta Description
All checks were successful
release-tag / release-image (push) Successful in 2m22s

This commit is contained in:
2025-05-05 20:58:17 +02:00
parent 10172d1fdc
commit 38fa612a18
3 changed files with 20 additions and 14 deletions

View File

@@ -58,10 +58,11 @@ func LoadDir(root string) ([]Article, error) {
}
var meta struct {
Title string `json:"title"`
Date string `json:"date"`
Slug string `json:"slug"`
Cover string `json:"cover"`
Title string `json:"title"`
Date string `json:"date"`
Slug string `json:"slug"`
Cover string `json:"cover"`
Description string `json:"description"`
}
if err := json.Unmarshal(headerJSON, &meta); err != nil {
return fmt.Errorf("%s: %w", path, err)
@@ -87,11 +88,12 @@ func LoadDir(root string) ([]Article, error) {
}
out = append(out, Article{
Title: meta.Title,
Slug: meta.Slug,
Date: date,
Cover: meta.Cover,
Body: template.HTML(body),
Title: meta.Title,
Slug: meta.Slug,
Date: date,
Cover: meta.Cover,
Description: meta.Description,
Body: template.HTML(body),
})
return nil
})

View File

@@ -7,9 +7,10 @@ import (
)
type Article struct {
Title string
Slug string
Date time.Time
Cover string //  NEW
Body template.HTML // already trusted
Title string
Slug string
Date time.Time
Cover string
Body template.HTML
Description string
}

View File

@@ -4,6 +4,9 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
{{ if .Description }}
<meta name="description" content="{{ .Description }}">
{{ end }}
<title>{{ block "title" . }}B1tsblog{{ end }}</title>
<link rel="stylesheet" href="/static/main.css">
</head>