NOTE: Federation is disabled on this instance!
You can test federation between the following instances:forge.angeley.es
code.angeley.es
By | fr33domlover |
At | 2019-06-06 |
Title | Add (empty) blog and Atom feed |
Description |
Edit file site.hs 33188 → 33188
42 | 42 | , sassHeaders = Nothing |
|
43 | 43 | , sassImporters = Nothing |
|
44 | 44 | , sassStripEncodingInfo = False |
|
45 | 45 | } |
|
46 | 46 | ||
+ | 47 | ||
+ | 48 | feedConfiguration :: FeedConfiguration |
|
+ | 49 | feedConfiguration = FeedConfiguration |
|
+ | 50 | { feedTitle = "little red cabin" |
|
+ | 51 | , feedDescription = "" |
|
+ | 52 | , feedAuthorName = "" |
|
+ | 53 | , feedAuthorEmail = "" |
|
+ | 54 | , feedRoot = "https://angeley.es" |
|
+ | 55 | } |
|
+ | 56 | ||
47 | 57 | fileStore :: FileStore |
|
48 | 58 | fileStore = gitStore |
|
49 | 59 | ||
50 | 60 | pageRoute :: Routes |
|
51 | 61 | pageRoute = customRoute $ (</> "index.html") . dropExtension . toFilePath |
|
… | … | … | … |
77 | 87 | route pageRoute |
|
78 | 88 | compile $ pandocCompiler |
|
79 | 89 | >>= loadAndApplyTemplate "templates/default.html" defaultContext |
|
80 | 90 | >>= relativizeUrls |
|
81 | 91 | ||
+ | 92 | create ["blog.atom"] $ do |
|
+ | 93 | route idRoute |
|
+ | 94 | compile $ do |
|
+ | 95 | let feedCtx = postCtx `mappend` bodyField "description" |
|
+ | 96 | posts <- |
|
+ | 97 | fmap (take 30) . recentFirst =<< |
|
+ | 98 | loadAllSnapshots "posts/*" "content" |
|
+ | 99 | renderAtom feedConfiguration feedCtx posts |
|
+ | 100 | ||
82 | 101 | match "poems/*" $ do |
|
83 | 102 | route pageRoute |
|
84 | 103 | compile $ pandocCompiler |
|
85 | 104 | >>= loadAndApplyTemplate "templates/poem.html" postCtx |
|
86 | 105 | >>= loadAndApplyTemplate "templates/default.html" postCtx |
|
… | … | … | … |
105 | 124 | compile $ pandocCompiler |
|
106 | 125 | >>= loadAndApplyTemplate "templates/poem.html" postCtx |
|
107 | 126 | >>= loadAndApplyTemplate "templates/default.html" postCtx |
|
108 | 127 | >>= relativizeUrls |
|
109 | 128 | ||
+ | 129 | match "posts/*" $ do |
|
+ | 130 | route pageRoute |
|
+ | 131 | compile $ pandocCompiler |
|
+ | 132 | >>= loadAndApplyTemplate "templates/poem.html" postCtx |
|
+ | 133 | >>= saveSnapshot "content" |
|
+ | 134 | >>= loadAndApplyTemplate "templates/default.html" postCtx |
|
+ | 135 | >>= relativizeUrls |
|
+ | 136 | ||
110 | 137 | create ["writings.html"] $ do |
|
111 | 138 | route pageRoute |
|
112 | 139 | compile $ do |
|
113 | 140 | poems <- chronological =<< loadAll "poems/*" |
|
114 | 141 | privPoems <- chronological =<< loadAll "private/poems/*" |
|
115 | 142 | stories <- chronological =<< loadAll "stories/*" |
|
116 | 143 | privStories <- chronological =<< loadAll "private/stories/*" |
|
+ | 144 | posts <- chronological =<< loadAll "posts/*" |
|
117 | 145 | let poemCtx = |
|
118 | 146 | listField "poems" postCtx (return poems) |
|
119 | 147 | <> listField "privPoems" postCtx (return privPoems) |
|
120 | 148 | <> listField "stories" postCtx (return stories) |
|
121 | 149 | <> listField "privStories" postCtx (return privStories) |
|
+ | 150 | <> listField "posts" postCtx (return posts) |
|
122 | 151 | <> constField "title" "Writings" |
|
123 | 152 | <> defaultContext |
|
124 | 153 | ||
125 | 154 | makeItem "" |
|
126 | 155 | >>= loadAndApplyTemplate "templates/writings.html" poemCtx |
|
… | … | … | … |
Edit file stack.yaml 33188 → 33188
- | 1 | resolver: lts-12.20 |
|
+ | 1 | resolver: lts-12.26 |
|
2 | 2 | ||
3 | 3 | packages: |
|
4 | 4 | - . |
|
5 | 5 | ||
6 | 6 | extra-deps: |
|
… | … | … | … |
Edit file templates/writings.html 33188 → 33188
43 | 43 | <a class="post-list__title" href="$url$">$title$</a> - <date |
|
44 | 44 | class="post-list__date" pubdate datetime="$date$">$date$</date> |
|
45 | 45 | </li> |
|
46 | 46 | $endfor$ |
|
47 | 47 | </ul> |
|
+ | 48 | ||
+ | 49 | <h2>Blog</h2> |
|
+ | 50 | ||
+ | 51 | <a href="/blog.atom">Atom feed</a> |
|
+ | 52 | ||
+ | 53 | <ul class="post-list"> |
|
+ | 54 | $for(posts)$ |
|
+ | 55 | <li> |
|
+ | 56 | <a class="post-list__title" href="$url$">$title$</a> - <date |
|
+ | 57 | class="post-list__date" pubdate datetime="$date$">$date$</date> |
|
+ | 58 | </li> |
|
+ | 59 | $endfor$ |
|
+ | 60 | </ul> |
|
… | … | … | … |