Now that we have conditional static templating, get rid of redundant templating variables (allTaggedPage + latestTaggedPage)
This commit is contained in:
parent
049576154a
commit
e136b97746
4 changed files with 8 additions and 20 deletions
|
@ -1,12 +1,10 @@
|
||||||
allLink = See all
|
allLink = See all
|
||||||
allPage = All articles
|
allPage = All articles{? tagged ${tag}?}
|
||||||
allTaggedPage = All articles tagged ${tag}
|
|
||||||
commentsLink = Comment on the fediverse
|
commentsLink = Comment on the fediverse
|
||||||
commentsSection = Comments
|
commentsSection = Comments
|
||||||
dateFormat = en-US
|
dateFormat = en-US
|
||||||
latestLink = See only latest
|
latestLink = See only latest
|
||||||
latestPage = Latest articles
|
latestPage = Latest articles{? tagged ${tag}?}
|
||||||
latestTaggedPage = Latest articles tagged ${tag}
|
|
||||||
metadata = {?by ${author} ?}on ${date}{? tagged ${tags}?}
|
metadata = {?by ${author} ?}on ${date}{? tagged ${tags}?}
|
||||||
rssLink = Subscribe
|
rssLink = Subscribe
|
||||||
rssTitle = Follow all articles{? tagged ${tag}?}
|
rssTitle = Follow all articles{? tagged ${tag}?}
|
||||||
|
|
|
@ -66,12 +66,7 @@ function DomRenderer(modules) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageTitle(tag, all) {
|
function pageTitle(tag, all) {
|
||||||
if(tag != undefined) {
|
return modules.template.render(all ? 'allPage' : 'latestPage', {tag: tag});
|
||||||
var template = all ? 'allTaggedPage' : 'latestTaggedPage';
|
|
||||||
return modules.template.render(template, {tag: tag});
|
|
||||||
} else {
|
|
||||||
return blog.wording[all ? 'allPage' : 'latestPage'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function otherUrl(tag, all) {
|
function otherUrl(tag, all) {
|
||||||
|
|
|
@ -34,13 +34,10 @@ otherURL (ArticlesList {full, collection}) = absoluteLink $
|
||||||
|
|
||||||
description :: Renderer m => ArticlesList -> m Text
|
description :: Renderer m => ArticlesList -> m Text
|
||||||
description (ArticlesList {full, collection}) =
|
description (ArticlesList {full, collection}) =
|
||||||
getDescription (full, tag collection)
|
template page . environment $ tag collection
|
||||||
where
|
where
|
||||||
getDescription (True, Nothing) = template "allPage" []
|
page = if full then "allPage" else "latestPage"
|
||||||
getDescription (True, Just tag) = template "allTaggedPage" [("tag", pack tag)]
|
environment = maybe [] $ \value -> [("tag", pack value)]
|
||||||
getDescription (False, Nothing) = template "latestPage" []
|
|
||||||
getDescription (False, Just tag) =
|
|
||||||
template "latestTaggedPage" [("tag", pack tag)]
|
|
||||||
|
|
||||||
rssLinkTexts :: Renderer m => ArticlesList -> m (Text, Text)
|
rssLinkTexts :: Renderer m => ArticlesList -> m (Text, Text)
|
||||||
rssLinkTexts (ArticlesList {collection}) = do
|
rssLinkTexts (ArticlesList {collection}) = do
|
||||||
|
|
|
@ -25,14 +25,12 @@ newtype Wording = Wording (Map String Text)
|
||||||
variables :: Map String [Text]
|
variables :: Map String [Text]
|
||||||
variables = Map.fromList [
|
variables = Map.fromList [
|
||||||
("allLink", [])
|
("allLink", [])
|
||||||
, ("allPage", [])
|
, ("allPage", ["tag"])
|
||||||
, ("allTaggedPage", ["tag"])
|
|
||||||
, ("commentsLink", [])
|
, ("commentsLink", [])
|
||||||
, ("commentsSection", [])
|
, ("commentsSection", [])
|
||||||
, ("dateFormat", [])
|
, ("dateFormat", [])
|
||||||
, ("latestLink", [])
|
, ("latestLink", [])
|
||||||
, ("latestPage", [])
|
, ("latestPage", ["tag"])
|
||||||
, ("latestTaggedPage", ["tag"])
|
|
||||||
, ("metadata", ["author", "date", "tags"])
|
, ("metadata", ["author", "date", "tags"])
|
||||||
, ("rssLink", [])
|
, ("rssLink", [])
|
||||||
, ("rssTitle", ["tag"])
|
, ("rssTitle", ["tag"])
|
||||||
|
|
Loading…
Reference in a new issue