From 375dbcfc74efeab0289e5e4355fd203b8ad2d6c8 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Thu, 13 Aug 2015 22:32:35 -0400 Subject: [PATCH] Fixed Tag pages pagination artifact Given a tag with name "gen", only "tags/gen1.html" through "tags/genN.html" should be generated. Before this commit, an addition file was unwittingly generated for each tag, which contained all posts tagged with that tag (in the case of tag "gen" it would have generated "tags/gen.html" which contains all posts tagged "gen"). Signed-off-by: Collin J. Doering --- TODO.org | 11 ++++++++++- src/site.hs | 16 ++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/TODO.org b/TODO.org index 98966dc..e4b09e1 100644 --- a/TODO.org +++ b/TODO.org @@ -23,7 +23,7 @@ In order to implement this, a reasonable size refactor needs to take place. Below is a list of things to be completed in order to successfully achieve the aforementioned goals. -*** TODO Fix issue with tag and pagination page generation <> +*** TODO [1/3] Fix issue with tag and pagination page generation <> Currently URLs to paginated pages (which includes the blog and tag pages) are broken. They generate "/tags/*.html" instead of "/tags/*1.html". @@ -33,6 +33,15 @@ artifact of pagination. It contains all blog posts (contained in "/blog1.html" through "/blogN.html"). +**** TODO Blog pagination +**** DONE Tag pages pagination + CLOSED: [2015-08-13 Thu 22:26] +**** TODO Tag cloud and tagField are broken + After fixing the [[Tag pages pagination]] issue, another issue cropped up. Namely: + + - tagCloud :: all links in tag cloud are to "/" instead of their respective tag page + - tagField :: nothing seems to be generated at all (no links to tags in blog posts) + *** Complete **** CANCELED Modify nav URLs using javascript once page is loaded CLOSED: [2015-08-13 Thu 01:47] diff --git a/src/site.hs b/src/site.hs index 0d86a20..265b1dd 100644 --- a/src/site.hs +++ b/src/site.hs @@ -321,7 +321,7 @@ paginateTagsRules loc tags = (\n -> fromCapture (fromGlob $ loc ++ "/" ++ tag ++ "*.html") (show n)) paginateRules paginatedTaggedPosts $ \pageNum pattern -> do - route idRoute + route $ gsubRoute " " (const "-") `composeRoutes` setExtension "html" compile $ do pages <- sortByM pageWeight =<< loadAll ("pages/*" .&&. hasVersion "nav-gen") posts <- recentFirst =<< loadAllSnapshots pattern "content" @@ -346,15 +346,11 @@ paginateTagsRules loc tags = >>= loadAndApplyTemplate "templates/default.html" indexCtx rulesExtraDependencies [tagsDependency tags] $ do - create [tagsMakeId tags tag] $ do - route $ gsubRoute " " (const "-") - compile $ makeItem ("" :: String) - - version "rss" $ do - route $ gsubRoute " " (const "-") `composeRoutes` setExtension "xml" - compile $ loadAllSnapshots (fromList identifiers) "content" - >>= fmap (take 10) . recentFirst - >>= renderAtom (feedConfiguration $ Just tag) (bodyField "description" <> defaultContext) + create [fromFilePath $ "tags/" ++ tag ++ ".xml"] $ do + route $ gsubRoute " " (const "-") `composeRoutes` setExtension "xml" + compile $ loadAllSnapshots (fromList identifiers) "content" + >>= fmap (take 10) . recentFirst + >>= renderAtom (feedConfiguration $ Just tag) (bodyField "description" <> defaultContext) postCtx :: Context String postCtx = dateField "date" "%B %e, %Y" <>