Add 'unlisted' key

unlisted posts will still be put in the normal place but
not added to the gallery or rss feed
This commit is contained in:
Rhiannon Morris 2021-10-02 23:00:33 +02:00
parent e07e90ccd1
commit a8e5adb50d
3 changed files with 6 additions and 1 deletions

View file

@ -90,6 +90,7 @@ make' root (GalleryInfo {title, desc, prefix, filters, hidden}) infos = [b|@0
infosByYear = infosByYear =
[(the year, infopath) | [(the year, infopath) |
infopath@(_, info) <- infos, infopath@(_, info) <- infos,
not $ #unlisted info,
then sortInfo by info, then sortInfo by info,
let year = #latestYear info nsfw, let year = #latestYear info nsfw,
then group by Down year using groupBy'] then group by Down year using groupBy']

View file

@ -45,6 +45,8 @@ data Info =
updates :: ![Update], updates :: ![Update],
-- | if false, don't show updated emblem even if @updates@ is non-empty -- | if false, don't show updated emblem even if @updates@ is non-empty
showUpdated :: !Bool, showUpdated :: !Bool,
-- | hide from gallery view
unlisted :: !Bool,
title :: !Text, title :: !Text,
artist :: !(Maybe Artist), -- nothing = me, obv artist :: !(Maybe Artist), -- nothing = me, obv
nsfwOnly :: !Bool, nsfwOnly :: !Bool,
@ -245,6 +247,7 @@ instance FromYAML Info where
<*> m .:? "sort" .!= "" <*> m .:? "sort" .!= ""
<*> (m .:? "updates" >>= updateList) <*> (m .:? "updates" >>= updateList)
<*> m .:? "show-updated" .!= True <*> m .:? "show-updated" .!= True
<*> m .:? "unlisted" .!= False
<*> m .: "title" <*> m .: "title"
<*> m .:? "artist" <*> m .:? "artist"
<*> m .:? "nsfw-only" .!= False <*> m .:? "nsfw-only" .!= False

View file

@ -40,7 +40,8 @@ make' root ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|@0
link = [b|$root/$prefix|] link = [b|$root/$prefix|]
nsfw = #nsfw ginfo nsfw = #nsfw ginfo
items = map (uncurry $ makeItem root prefix nsfw) $ items = map (uncurry $ makeItem root prefix nsfw) $
sortBy (flip (compareFor nsfw `on` #second)) infos sortBy (flip (compareFor nsfw `on` #second)) $
filter (not . #unlisted . snd) infos
selflink = case output of selflink = case output of
Nothing -> "" Nothing -> ""
Just o -> [b|<atom:link href="$link/$o" rel="self" />|] Just o -> [b|<atom:link href="$link/$o" rel="self" />|]