Hi,
I'm in the process of assembling an atom feed from my post list (I'm using a custom chronological sort, because I don't have dates in the filenames.) But, I'm stuck on how to get the following:
1. Full URLs.
Using the $url$ placeholder, I can get the relative URI for a post. How would I either combine the root URI or find out the full one inside a post?
2. Updated date if present
In my post metadata, I'm typically only defining "published:". But, occasionally I'll define it. How could I set the published date to copy over to the updated date if the "updated" metadata is not present?
3. Last updated post date
This is for the main <feed><updated> field. What's the easiest way of getting that?
I have a list of posts, the top item will be the most recent, see:
myChronological :: [Page a] -> [Page a]
myChronological = reverse . (sortBy $ comparing $ getField "published")
And so:
-- Render RSS feed
match "atom.xml" $ route idRoute
create "atom.xml" $ constA mempty
>>> setFieldPageList myChronological
"templates/atom_item.xml" "posts" "posts/*"
>>> arr (copyBodyToField "description")
>>> arr applySelf
>>> applyTemplateCompiler "templates/atom.xml"
>>> relativizeUrlsCompiler
Thanks,
Nick.