From 1661db2ac393d46c02f6e6e84eb9628d04f47b5f Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 16 Mar 2023 10:25:45 -0700 Subject: [PATCH] add tags support --- Dockerfile | 1 - walk.go | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5ccf524..bf38d60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ # File generated by github.com/posener/goaction. DO NOT EDIT. - FROM golang:1.16-alpine3.14 RUN apk add git diff --git a/walk.go b/walk.go index 59e4dcb..d6a472e 100644 --- a/walk.go +++ b/walk.go @@ -14,8 +14,9 @@ import ( ) type Front struct { - Title string `yaml:"title"` - Draft bool `yaml:"draft"` + Title string `yaml:"title"` + Draft bool `yaml:"draft"` + Tags []string `yaml:"tags"` } // recursively walk directory and return all files with given extension @@ -52,6 +53,7 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res [] matter = Front{ Title: "Untitled Page", Draft: false, + Tags: []string{}, } body = text } @@ -72,6 +74,7 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res [] LastModified: info.ModTime(), Title: title, Content: body, + Tags: matter.Tags, } res = append(res, parse(s, root)...) } else {