flattr buttons

This commit is contained in:
nek0 2016-05-09 22:09:13 +02:00
parent c04f801d67
commit 0b9195ced8
3 changed files with 34 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
import Data.Monoid (mappend)
import Hakyll
import Data.Monoid ((<>), mconcat)
import Data.List (sort, delete)
import Data.List (sort, delete, intercalate)
import System.Directory
--------------------------------------------------------------------------------
@ -65,9 +65,12 @@ main = do
paginateRules pages $ \num _ -> do
route $ setExtension "html"
compile $ do
let ident = paginateMakeId pages $ num
tagList <- getTags ident
let tagString = intercalate "," tagList
compiled <- getResourceBody >>= renderPandoc
let pageCtx = paginateContext pages num
let ctx = (postCtx tags) <> pageCtx
let ctx = (postCtx tags) <> pageCtx <> flattrCtx tagString
full <- loadAndApplyTemplate "templates/post.html" ctx compiled
_ <- saveSnapshot "content" compiled
loadAndApplyTemplate "templates/default.html" baseCtx full
@ -139,6 +142,13 @@ feedCtx = mconcat
--------------------------------------------------------------------------------
flattrCtx :: String -> Context String
flattrCtx str = mconcat
[ constField "rawtags" str
]
--------------------------------------------------------------------------------
feedConf :: FeedConfiguration
feedConf = FeedConfiguration
{ feedTitle = "nek0's blog"

View File

@ -10,6 +10,8 @@
$body$
<a class="flattr" href="https://flattr.com/submit/auto?user_id=nek0&url=$url$&title=$title$&tags=$rawtags$" alt="flattr this!">flattr this!</a>
<div class="pagination">
$if(previousPageNum)$
<a class="left" href="$previousPageUrl$"><svg width="1em" height="1em" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1664 896v128q0 53-32.5 90.5t-84.5 37.5h-704l293 294q38 36 38 90t-38 90l-75 76q-37 37-90 37-52 0-91-37l-651-652q-37-37-37-90 0-52 37-91l651-650q38-38 91-38 52 0 90 38l75 74q38 38 38 91t-38 91l-293 293h704q52 0 84.5 37.5t32.5 90.5z"/></svg>previous post</a>