Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
39
src/site.hs
39
src/site.hs
@@ -13,13 +13,12 @@ import Text.Pandoc.Templates (Template, compileTemplate)
|
|||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = hakyllWith config $ do
|
main = hakyllWith config $ do
|
||||||
let
|
let individualPatterns = fromList ["about.org", "contact.org", "links.org"]
|
||||||
individualPatterns = fromList ["about.org", "contact.org", "links.org"]
|
|
||||||
|
|
||||||
match "images/**" $ do
|
match "images/**" $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile copyFileCompiler
|
compile copyFileCompiler
|
||||||
|
|
||||||
match "fonts/*" $ do
|
match "fonts/*" $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile copyFileCompiler
|
compile copyFileCompiler
|
||||||
@@ -62,7 +61,7 @@ main = hakyllWith config $ do
|
|||||||
let writerOptions' = maybe defaultHakyllWriterOptions (const $ writerOptions $ isJust numbering) toc
|
let writerOptions' = maybe defaultHakyllWriterOptions (const $ writerOptions $ isJust numbering) toc
|
||||||
pandocCompilerWith defaultHakyllReaderOptions writerOptions'
|
pandocCompilerWith defaultHakyllReaderOptions writerOptions'
|
||||||
>>= saveSnapshot "content"
|
>>= saveSnapshot "content"
|
||||||
>>= loadAndApplyTemplate "templates/post.html" (postCtx tags <> teaserField "teaser" "content")
|
>>= loadAndApplyTemplate "templates/post.html" (postCtx tags)
|
||||||
>>= loadAndApplyTemplate "templates/default.html" (postCtx tags)
|
>>= loadAndApplyTemplate "templates/default.html" (postCtx tags)
|
||||||
>>= relativizeUrls
|
>>= relativizeUrls
|
||||||
|
|
||||||
@@ -101,28 +100,29 @@ main = hakyllWith config $ do
|
|||||||
posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "posts/*" "content"
|
posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "posts/*" "content"
|
||||||
renderRss rssFeedConfiguration feedCtx posts
|
renderRss rssFeedConfiguration feedCtx posts
|
||||||
|
|
||||||
-- https://robertwpearce.com/hakyll-pt-2-generating-a-sitemap-xml-file.html
|
-- https://robertwpearce.com/hakyll-pt-2-generating-a-sitemap-xml-file.html
|
||||||
create ["sitemap.xml"] $ do
|
create ["sitemap.xml"] $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
posts <- recentFirst =<< loadAll "posts/*"
|
posts <- recentFirst =<< loadAll "posts/*"
|
||||||
individualPages <- loadAll individualPatterns
|
individualPages <- loadAll individualPatterns
|
||||||
let pages = posts <> individualPages
|
let pages = posts <> individualPages
|
||||||
sitemapCtx =
|
sitemapCtx =
|
||||||
listField "pages" (postCtx tags) (return pages)
|
listField "pages" (postCtx tags) (return pages)
|
||||||
<> defaultCtx
|
<> defaultCtx
|
||||||
makeItem ""
|
makeItem ""
|
||||||
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
|
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
|
||||||
|
|
||||||
match "templates/*" $ compile templateBodyCompiler
|
match "templates/*" $ compile templateBodyCompiler
|
||||||
|
|
||||||
rssFeedConfiguration :: FeedConfiguration
|
rssFeedConfiguration :: FeedConfiguration
|
||||||
rssFeedConfiguration = FeedConfiguration
|
rssFeedConfiguration =
|
||||||
{ feedTitle = "nattopages"
|
FeedConfiguration
|
||||||
, feedDescription = "Pages by natto"
|
{ feedTitle = "nattopages",
|
||||||
, feedAuthorName = "Amneesh Singh"
|
feedDescription = "Pages by natto",
|
||||||
, feedAuthorEmail = "natto@weirdnatto.in"
|
feedAuthorName = "Amneesh Singh",
|
||||||
, feedRoot = "https://weirdnatto.in"
|
feedAuthorEmail = "natto@weirdnatto.in",
|
||||||
|
feedRoot = "https://weirdnatto.in"
|
||||||
}
|
}
|
||||||
|
|
||||||
config :: Configuration
|
config :: Configuration
|
||||||
@@ -141,7 +141,6 @@ postCtx tags =
|
|||||||
-- <> teaserFieldWithSeparator "((.tease.))" "teaser" "content"
|
-- <> teaserFieldWithSeparator "((.tease.))" "teaser" "content"
|
||||||
<> dateField "date" "%B %e, %Y"
|
<> dateField "date" "%B %e, %Y"
|
||||||
<> dateField "altdate" "%Y-%m-%d"
|
<> dateField "altdate" "%Y-%m-%d"
|
||||||
-- <> modificationTimeFieldWith TimeLocale.knownTimeZones. "modified" "%B %e, %Y"
|
|
||||||
<> teaserField "teaser" "content"
|
<> teaserField "teaser" "content"
|
||||||
<> defaultCtx
|
<> defaultCtx
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user