Skip to content

Commit

Permalink
Merge pull request #143 from krymtkts/feature/index-title
Browse files Browse the repository at this point in the history
Use siteName for index.html instead of latest post's title.
  • Loading branch information
krymtkts authored Jan 20, 2024
2 parents 19dc78e + cccccbc commit b35d6d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ module Misc =
leaf: string
date: string
pubDate: string option
publish: bool }
publish: bool
index: bool }

let getDestinationPath (source: string) (dir: string) =
Directory.leaf source
Expand Down
12 changes: 7 additions & 5 deletions src/Generator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ module Rendering =
leaf = leafHtml source
date = date
pubDate = pubDate
publish = date <= today }
publish = date <= today
index = false }
}

let private writeContent
Expand All @@ -283,9 +284,9 @@ module Rendering =
|> Seq.last

let title =
match meta.frontMatter with
| Some fm -> $"%s{conf.title} - %s{fm.title}"
| None -> conf.title
match meta.index, meta.frontMatter with
| false, Some fm -> $"%s{conf.title} - %s{fm.title}"
| _ -> conf.title

let header =
Component.header $"%s{root.siteRoot}%s{root.tagRoot}/" meta.pubDate meta.frontMatter
Expand Down Expand Up @@ -335,6 +336,7 @@ module Rendering =
}

let renderIndex conf site metaPosts dest =
let index m = { m with index = true }
let meta, metaPrev =
match metaPosts
|> Seq.sortBy (fun m -> IO.leaf m.source)
Expand All @@ -348,7 +350,7 @@ module Rendering =

promise {
let dest = IO.resolve dest
do! writeContent conf site meta dest metaPrev None
do! writeContent conf site (index meta) dest metaPrev None
}

let renderArchives conf site archives dest =
Expand Down

0 comments on commit b35d6d9

Please sign in to comment.