all repos — homestead @ 90935f0741435753afe81c6af03be63380a55393

Code for my website

push path mapping to storage layer

Alan Pearce
commit

90935f0741435753afe81c6af03be63380a55393

parent

3aa7a83d75aa08a39fcffe592c6e3818e2eea65a

2 files changed, 2 insertions(+), 13 deletions(-)

jump to
M internal/builder/builder.gointernal/builder/builder.go
@@ -211,7 +211,7 @@ return nil, err
} buf.Reset() - log.Debug("rendering page", "source", page, "output", post.Output) + log.Debug("rendering page", "source", page, "path", post.URL) if page == "index.md" { if err := templates.Homepage(config, cc.Posts, post).Render(ctx, buf); err != nil { return nil, err
@@ -221,7 +221,7 @@ if err := templates.Page(config, post).Render(ctx, buf); err != nil {
return nil, err } } - if err := storage.Write(post.Output, buf); err != nil { + if err := storage.Write(post.URL, buf); err != nil { return nil, err } }
M internal/content/posts.gointernal/content/posts.go
@@ -32,7 +32,6 @@ }
type Post struct { Input string - Output string Basename string URL string Commits []*vcs.Commit
@@ -57,10 +56,6 @@ StaticFiles []string
Tags mapset.Set[string] } -var postOutputReplacer = strings.NewReplacer( - "index.md", "index.html", - ".md", "/index.html", -) var postURLReplacer = strings.NewReplacer( "index.md", "", ".md", "/",
@@ -75,7 +70,6 @@ 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{},
@@ -90,10 +84,6 @@
return post, nil } -var pageOutputReplacer = strings.NewReplacer( - "index.md", "index.html", - ".md", ".html", -) var pageURLReplacer = strings.NewReplacer( "index.md", "", ".md", "",
@@ -104,7 +94,6 @@ fp := filepath.Join(cc.config.Root, filename)
url := path.Join("/", pageURLReplacer.Replace(filename)) post := &Post{ Input: fp, - Output: pageOutputReplacer.Replace(filename), Basename: filepath.Base(url), URL: url, PostMatter: &PostMatter{},