Compare commits

...

3 Commits

Author SHA1 Message Date
4aa23bc67c templates: add sitemap.xml
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-22 08:56:48 +05:30
79545f35d0 posts: Done With ConcourseCI
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-22 08:25:12 +05:30
b08f757b2c add modification timestamp
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-22 08:25:12 +05:30
4 changed files with 67 additions and 11 deletions

View File

@@ -0,0 +1,22 @@
---
title: I am done with ConcourseCI
author: natto
tags: ci, devops, concourse
published: October 20, 2022
enabletoc: true
---
* Background
I spent a lot of time (almost entire February/March and random days here and there) on learning concourse, setting it up (under Nomad with Vault on an aarch64 NixOS machine with limited resources, you know which one) and working on resources for it to work with Gitea earlier this year. I spent so much time on something that I am probably never going to use again and I hate myself for it.
* KIA
What was lost? A lot of time and more time dwelling upon the formerly wasted time. I could have used that time for my many other hobbies or I could have spent more time on other stuff, like programming, that I actually enjoy but lack experience in.
* Why even
I used concourse because of the shills that like to shill every relatively obscure thing out there. Just because it is hard to understand and has sophisticated (arguable) internals does not mean it is practical and fun. I do not hate concourse all that much but it fails to complete my needs and I refuse to work on resources for every little thing, maybe will work on improving the support some time later in the distant future, but not now. It might be good for complicated pipelines but mine are relatively simple.
* Starting over is hard
Starting over again is seriously hard, how will I ever be able to justify the lost time? But ideally, I should not feel the need to justify it.
* What now
I will use DroneCI as soon as I am done with rewiring this stupid pile of messs at my home. It is not much better than concourse but it fits my needs. I am afraid that it might just be another concourse and if that happens, I will give up on self hosting and move completely to GitHub+Actions or GitLab but let's try to avoid that since that is no +pain+ fun. Goodbye concourse, I do not hate you but we cannot be together.

View File

@@ -13,24 +13,22 @@ import Text.Pandoc.Templates (Template, compileTemplate)
main :: IO ()
main = hakyllWith config $ do
match "images/logos/*" $ do
let
individualPatterns = fromList ["about.org", "contact.org", "links.org"]
match "images/**" $ do
route idRoute
compile copyFileCompiler
match "fonts/*" $ do
route idRoute
compile copyFileCompiler
match "sitemap.xml" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match (fromList ["about.org", "contact.org", "links.org"]) $ do
match individualPatterns $ do
route $ setExtension "html"
compile $
pandocCompiler
@@ -103,9 +101,18 @@ main = hakyllWith config $ do
posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "posts/*" "content"
renderRss rssFeedConfiguration feedCtx posts
match "images/*" $ do
-- https://robertwpearce.com/hakyll-pt-2-generating-a-sitemap-xml-file.html
create ["sitemap.xml"] $ do
route idRoute
compile copyFileCompiler
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
individualPages <- loadAll individualPatterns
let pages = posts <> individualPages
sitemapCtx =
listField "pages" (postCtx tags) (return pages)
<> defaultCtx
makeItem ""
>>= loadAndApplyTemplate "templates/sitemap.xml" sitemapCtx
match "templates/*" $ compile templateBodyCompiler
@@ -133,6 +140,7 @@ postCtx tags =
tagsField "tags" tags
-- <> teaserFieldWithSeparator "((.tease.))" "teaser" "content"
<> dateField "date" "%B %e, %Y"
<> modificationTimeField "modified" "%B %e, %Y"
<> teaserField "teaser" "content"
<> defaultCtx

View File

@@ -4,9 +4,12 @@
Posted on $date$
$if(author)$
by $author$
$endif$ <br>
$endif$<br>
$if(tags)$
Tags: $tags$
$endif$<br>
$if(modified)$
Last modified on $modified$
$endif$
</section>
<hr>

23
templates/sitemap.xml Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
>
<url>
<loc>$domain$</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
$for(pages)$
<url>
<loc>$domain$$url$</loc>
<lastmod>$if(updated)$$updated$$else$$if(time)$$date$$endif$$endif$</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
$endfor$
</urlset>