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 <collin.doering@rekahsoft.ca>
This commit is contained in:
Collin J. Doering 2015-08-13 22:32:35 -04:00
parent deb81e9cbd
commit 375dbcfc74
2 changed files with 16 additions and 11 deletions

View File

@ -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 <<link issue>>
*** TODO [1/3] Fix issue with tag and pagination page generation <<link issue>>
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]

View File

@ -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" <>