Test Meta Description
All checks were successful
release-tag / release-image (push) Successful in 2m22s
All checks were successful
release-tag / release-image (push) Successful in 2m22s
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user