~kungtotte/dtt

3d7d09dde9fd9df5336920125db2cb6a5827b051 — Thomas Landin 6 months ago 38e66e6
Fixed a bug introduced during refactoring

I didn't properly render blog posts as actual pages so they didn't get
any CSS styling or anything, that's fixed now though.
1 files changed, 8 insertions(+), 9 deletions(-)

M src/dtt.nim
M src/dtt.nim => src/dtt.nim +8 -9
@@ 106,20 106,19 @@ proc buildCmd(posts_per_page: int = 5) =
      copyFile(content_dir / f, output_file)
      setFilePermissions(output_file, outFilePerms)
    else:
      var page: PageMeta
      page.title = name.title()
      page.filename = name & ".html"
      page.abs_path = content_dir / f
      page.rel_path = dir / name & ".html"
      page.out_path = savepath
      page.tmpl = if existsFile(tmpl_dir / name & ".mustache"): name else: "page"
      pages.add(page)
      if isBlog(dir, name):
        let post = buildBlogPost(content_dir / f, tmpl_dir)
        posts.add(post)
        writeFile(savepath / name & ".html", post.content)
      else:
        var page: PageMeta
        page.title = name.title()
        page.filename = name & ".html"
        page.abs_path = content_dir / f
        page.rel_path = dir / name & ".html"
        page.out_path = savepath
        page.tmpl = if existsFile(tmpl_dir / name & ".mustache"): name else: "page"
        links.add({"target": page.rel_path, "title": page.title}.toTable)
        pages.add(page)

  let
    num_blogs = min(posts.len - 1, posts_per_page)