all repos — homestead @ 431e351c78000ccd0d6bf035b4cd1092a7744d85

Code for my website

show date last updated for posts with multiple commits

Alan Pearce
commit

431e351c78000ccd0d6bf035b4cd1092a7744d85

parent

677f6211540940a1bdccb07cae059b4343807f1a

1 file changed, 9 insertions(+), 1 deletion(-)

changed files
M internal/content/posts.gointernal/content/posts.go
@@ -13,6 +13,7 @@ "strings"
"time" "go.alanpearce.eu/website/internal/markdown" + "go.alanpearce.eu/website/internal/vcs" "go.alanpearce.eu/x/log" "github.com/adrg/frontmatter"
@@ -34,6 +35,7 @@ Input string
Output string Basename string URL string + Commits []*vcs.Commit *PostMatter content []byte
@@ -42,6 +44,7 @@
type Config struct { Root string PostDir string + Repo *vcs.Repository } type Collection struct {
@@ -66,15 +69,20 @@
func (cc *Collection) GetPost(filename string) (*Post, error) { fp := filepath.Join(cc.config.Root, filename) url := path.Join("/", postURLReplacer.Replace(filename)) + "/" + cs, err := cc.config.Repo.GetFileLog(filename) + if err != nil { + return nil, errors.WithMessagef(err, "could not get commit log for file %s", filename) + } post := &Post{ Input: fp, Output: postOutputReplacer.Replace(filename), Basename: filepath.Base(url), URL: url, PostMatter: &PostMatter{}, + Commits: cs, } - err := parse(fp, post) + err = parse(fp, post) if err != nil { return nil, err }