Created
July 29, 2012 05:17
-
-
Save dekokun/3196214 to your computer and use it in GitHub Desktop.
HakyllにRSS機能を追加した際のdiff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/data/gh-pages.hs b/data/gh-pages.hs | |
index ed05733..6bf60cb 100644 | |
--- a/data/gh-pages.hs | |
+++ b/data/gh-pages.hs | |
@@ -44,6 +44,13 @@ main = hakyllWith config $ do | |
-- Read templates | |
match "templates/*" $ compile templateCompiler | |
+ -- Render RSS feed | |
+ match "rss.xml" $ route idRoute | |
+ create "rss.xml" $ | |
+ requireAll_ "posts/*" | |
+ >>> mapCompiler (arr $ copyBodyToField "description") | |
+ >>> renderRss feedConfiguration | |
+ | |
-- | Auxiliary compiler: generate a post list from a list of given posts, and | |
-- add it to the current page under @$posts@ | |
-- | |
@@ -56,3 +63,11 @@ addPostList = setFieldA "posts" $ | |
config :: HakyllConfiguration | |
config = defaultHakyllConfiguration { deployCommand = deploy } | |
where deploy = "make deploy && make clean" | |
+ | |
+feedConfiguration :: FeedConfiguration | |
+feedConfiguration = FeedConfiguration | |
+ { feedTitle = "机上日記 RSS feed" | |
+ , feedDescription = "机上日記のRSSフィード" | |
+ , feedAuthorName = "dekokun" | |
+ , feedRoot = "http://dekokun.github.com/" | |
+ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment