Add syndication feeds

parent 66383221
Pipeline #29940031 passed with stages
in 59 minutes and 37 seconds
......@@ -40,6 +40,10 @@ footer {
padding: 1em 0;
}
footer .feed {
float: left;
}
article .header {
color: #555;
font-size: 0.9em;
......@@ -81,10 +85,6 @@ section:nth-child(odd) {
margin-left: 0.5em;
}
h1 {
float: left;
}
h2 {
border-width: 1px 0 0;
border-style: dashed;
......
......@@ -7,6 +7,8 @@
<p>For support and discussion, use the official IRC channel: <a href="irc://irc.freenode.net/ercoin"><code>#ercoin</code> on <code>irc.freenode.net</code></a>. You can connect either <a href="https://freenode.net/kb/answer/chat">directly</a> or using the <a href="https://matrix.org/">Matrix</a> bridge (<code>#freenode_#ercoin:matrix.org</code>). There is also <a href="https://bitcointalk.org/index.php?topic=2071642">a semi-official thread on Bitcointalk</a> and <a href="https://t.me/ercoin_chat">a Telegram group</a>.</p>
<p>Syndication feeds: <a href="/atom.xml">news</a>, <a href="https://gitlab.com/Ercoin.atom">activity in the GitLab group</a>, <a href="https://gitlab.com/Ercoin/ercoin.atom">activity in the main Ercoin repository</a>, <a href="https://gitlab.com/Ercoin/ercoin/commits/master?format=atom">commits to the main Ercoin repository</a>. There are also feeds of other repositories.</p>
<p>Social media: <a href="https://twitter.com/ErcoinTech">Twitter</a>.</p>
</article>
......
......@@ -11,6 +11,15 @@ config = defaultConfiguration {
destinationDirectory = "public"
}
feedConfig :: FeedConfiguration
feedConfig = FeedConfiguration
{ feedTitle = "Ercoin news"
, feedDescription = "Ercoin news from the core site"
, feedAuthorEmail = "noreply@ercoin.tech"
, feedAuthorName = "Ercoin contributors"
, feedRoot = "https://ercoin.tech"
}
main :: IO ()
main = hakyllWith config $ do
match "images/*" $ do
......@@ -21,20 +30,21 @@ main = hakyllWith config $ do
route idRoute
compile compressCssCompiler
match "posts/*" $ do
match "news/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
create ["archive.html"] $ do
create ["news.html"] $ do
route idRoute
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
posts <- recentFirst =<< loadAll "news/*"
let archiveCtx =
listField "posts" postCtx (return posts) `mappend`
constField "title" "Archives" `mappend`
constField "title" "News" `mappend`
defaultContext
makeItem ""
......@@ -59,6 +69,14 @@ main = hakyllWith config $ do
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
create ["atom.xml"] $ do
route idRoute
compile $ do
let feedCtx = postCtx `mappend` bodyField "description"
posts <- fmap (take 10) . recentFirst =<<
loadAllSnapshots "news/*" "content"
renderAtom feedConfig feedCtx posts
match "templates/*" $ compile templateBodyCompiler
......
Here you can find all my previous posts:
$partial("templates/post-list.html")$
......@@ -4,8 +4,9 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ercoin $if(title)$— $title$$endif$</title>
<link rel="stylesheet" href="/css/default.css" />
<link rel="stylesheet" href="/css/default.css">
<link rel="shortcut icon" href="/images/ercoin.svg">
<link rel="alternate" type="application/atom+xml" title="News feed" href="/atom.xml">
</head>
<body>
<header>
......@@ -28,6 +29,9 @@
</main>
<footer>
<span class="feed">
<a href="/atom.xml">News feed (Atom)</a>
</span>
Site proudly generated by
<a href="http://jaspervdj.be/hakyll">Hakyll</a>
</footer>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment