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:
parent
deb81e9cbd
commit
375dbcfc74
11
TODO.org
11
TODO.org
|
@ -23,7 +23,7 @@
|
||||||
In order to implement this, a reasonable size refactor needs to take place. Below is a list
|
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.
|
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
|
Currently URLs to paginated pages (which includes the blog and tag pages) are broken. They
|
||||||
generate "/tags/*.html" instead of "/tags/*1.html".
|
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
|
artifact of pagination. It contains all blog posts (contained in "/blog1.html" through
|
||||||
"/blogN.html").
|
"/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
|
*** Complete
|
||||||
**** CANCELED Modify nav URLs using javascript once page is loaded
|
**** CANCELED Modify nav URLs using javascript once page is loaded
|
||||||
CLOSED: [2015-08-13 Thu 01:47]
|
CLOSED: [2015-08-13 Thu 01:47]
|
||||||
|
|
16
src/site.hs
16
src/site.hs
|
@ -321,7 +321,7 @@ paginateTagsRules loc tags =
|
||||||
(\n -> fromCapture (fromGlob $ loc ++ "/" ++ tag ++ "*.html") (show n))
|
(\n -> fromCapture (fromGlob $ loc ++ "/" ++ tag ++ "*.html") (show n))
|
||||||
|
|
||||||
paginateRules paginatedTaggedPosts $ \pageNum pattern -> do
|
paginateRules paginatedTaggedPosts $ \pageNum pattern -> do
|
||||||
route idRoute
|
route $ gsubRoute " " (const "-") `composeRoutes` setExtension "html"
|
||||||
compile $ do
|
compile $ do
|
||||||
pages <- sortByM pageWeight =<< loadAll ("pages/*" .&&. hasVersion "nav-gen")
|
pages <- sortByM pageWeight =<< loadAll ("pages/*" .&&. hasVersion "nav-gen")
|
||||||
posts <- recentFirst =<< loadAllSnapshots pattern "content"
|
posts <- recentFirst =<< loadAllSnapshots pattern "content"
|
||||||
|
@ -346,15 +346,11 @@ paginateTagsRules loc tags =
|
||||||
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
>>= loadAndApplyTemplate "templates/default.html" indexCtx
|
||||||
|
|
||||||
rulesExtraDependencies [tagsDependency tags] $ do
|
rulesExtraDependencies [tagsDependency tags] $ do
|
||||||
create [tagsMakeId tags tag] $ do
|
create [fromFilePath $ "tags/" ++ tag ++ ".xml"] $ do
|
||||||
route $ gsubRoute " " (const "-")
|
route $ gsubRoute " " (const "-") `composeRoutes` setExtension "xml"
|
||||||
compile $ makeItem ("" :: String)
|
compile $ loadAllSnapshots (fromList identifiers) "content"
|
||||||
|
>>= fmap (take 10) . recentFirst
|
||||||
version "rss" $ do
|
>>= renderAtom (feedConfiguration $ Just tag) (bodyField "description" <> defaultContext)
|
||||||
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 :: Context String
|
||||||
postCtx = dateField "date" "%B %e, %Y" <>
|
postCtx = dateField "date" "%B %e, %Y" <>
|
||||||
|
|
Loading…
Reference in New Issue