Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-05-12 20:30:31 +05:30
parent 216ca60d6c
commit 0e6d6d79a2
10 changed files with 345 additions and 56 deletions

View File

@@ -20,10 +20,12 @@ body {
header { header {
border-bottom: 0.2rem solid #000; border-bottom: 0.2rem solid #000;
margin: 4.2rem 0;
} }
nav { nav {
text-align: right; text-align: center;
margin: 0 auto 3rem;
} }
nav a { nav a {
@@ -34,6 +36,11 @@ nav a {
text-transform: uppercase; text-transform: uppercase;
} }
nav a:hover {
color: pink;
}
footer { footer {
margin-top: 3rem; margin-top: 3rem;
padding: 1.2rem 0; padding: 1.2rem 0;
@@ -56,9 +63,19 @@ article .header {
color: #555; color: #555;
} }
.logo {
text-align: center;
margin: 1rem auto 3rem;
}
.logo a:hover {
transform: rotate(180deg);
}
.logo a { .logo a {
font-weight: bold; font-weight: bold;
font-family: "Monoid Bold"; font-family: "Monoid Bold";
font-size: 3rem;
color: #000; color: #000;
text-decoration: none; text-decoration: none;
} }
@@ -82,27 +99,18 @@ article .header {
margin: 0; margin: 0;
padding: 0 5%; padding: 0 5%;
} }
header {
margin: 4.2rem 0;
}
nav {
margin: 0 auto 3rem;
text-align: center;
}
footer { footer {
text-align: center; text-align: center;
} }
.logo {
text-align: center;
margin: 1rem auto 3rem;
}
.logo a {
font-size: 2.4rem;
}
nav a { nav a {
display: block; display: block;
line-height: 1.6; line-height: 1.6;
} }
.sticky {
position: fixed;
top: 0;
background: white;
}
} }
@media (min-width: 320px) { @media (min-width: 320px) {
@@ -111,23 +119,9 @@ article .header {
margin: 0; margin: 0;
padding: 0 5%; padding: 0 5%;
} }
header {
margin: 4.2rem 0;
}
nav {
margin: 0 auto 3rem;
text-align: center;
}
footer { footer {
text-align: center; text-align: center;
} }
.logo {
text-align: center;
margin: 1rem auto 3rem;
}
.logo a {
font-size: 2.4rem;
}
nav a { nav a {
display: inline; display: inline;
margin: 0 0.6rem; margin: 0 0.6rem;
@@ -140,14 +134,6 @@ article .header {
margin: 0 auto; margin: 0 auto;
padding: 0; padding: 0;
} }
header {
margin: 0 0 3rem;
padding: 1.2rem 0;
}
nav {
margin: 0;
text-align: right;
}
nav a { nav a {
margin: 0 0 0 1.2rem; margin: 0 0 0 1.2rem;
display: inline; display: inline;
@@ -155,12 +141,4 @@ article .header {
footer { footer {
text-align: right; text-align: right;
} }
.logo {
margin: 0;
text-align: left;
}
.logo a {
float: left;
font-size: 1.8rem;
}
} }

View File

@@ -1,5 +1,227 @@
--- ---
title: alo title: alo
tags: amaang
--- ---
this is so true
* a * a
3
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
* a
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3

48
site.hs
View File

@@ -1,7 +1,6 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
import Data.Monoid (mappend)
import Hakyll import Hakyll
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -22,12 +21,44 @@ main = hakyllWith config $ do
>>= loadAndApplyTemplate "templates/default.html" defaultCtx >>= loadAndApplyTemplate "templates/default.html" defaultCtx
>>= relativizeUrls >>= relativizeUrls
tags <- buildTags "posts/*" (fromCapture "archive/tags/*.html")
tagsRules tags $ \tag pattern -> do
let title = "Posts tagged \"" ++ tag ++ "\""
route idRoute
compile $ do
posts <- recentFirst =<< loadAll pattern
let tagCtx =
constField "title" title
<> constField "tag" tag
<> listField "posts" (postCtx tags) (return posts)
<> defaultCtx
makeItem ""
>>= loadAndApplyTemplate "templates/tag.html" tagCtx
>>= loadAndApplyTemplate "templates/default.html" tagCtx
>>= relativizeUrls
create ["archive/tags.html"] $ do
route idRoute
compile $ do
let tagListCtx =
field "tags" (\_ -> renderTagList tags)
<> constField "title" "Tag List"
<> defaultCtx
makeItem ""
>>= loadAndApplyTemplate "templates/tags.html" tagListCtx
>>= loadAndApplyTemplate "templates/default.html" tagListCtx
>>= relativizeUrls
match "posts/*org" $ do match "posts/*org" $ do
route $ setExtension "html" route $ setExtension "html"
compile $ compile $
pandocCompiler pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx >>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/default.html" postCtx >>= loadAndApplyTemplate "templates/post.html" (postCtx tags)
>>= loadAndApplyTemplate "templates/default.html" (postCtx tags)
>>= relativizeUrls >>= relativizeUrls
create ["archive.html"] $ do create ["archive.html"] $ do
@@ -35,7 +66,7 @@ main = hakyllWith config $ do
compile $ do compile $ do
posts <- recentFirst =<< loadAll "posts/*" posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx = let archiveCtx =
listField "posts" postCtx (return posts) listField "posts" (postCtx tags) (return posts)
<> constField "title" "Archives" <> constField "title" "Archives"
<> defaultCtx <> defaultCtx
@@ -49,7 +80,7 @@ main = hakyllWith config $ do
compile $ do compile $ do
posts <- recentFirst =<< loadAll "posts/*" posts <- recentFirst =<< loadAll "posts/*"
let indexCtx = let indexCtx =
listField "posts" postCtx (return posts) listField "posts" (postCtx tags) (return posts)
<> defaultCtx <> defaultCtx
getResourceBody getResourceBody
@@ -69,9 +100,10 @@ config =
previewPort = 3333 previewPort = 3333
} }
postCtx :: Context String postCtx :: Tags -> Context String
postCtx = postCtx tags =
dateField "date" "%B %e, %Y" tagsField "tags" tags
<> dateField "date" "%B %e, %Y"
<> defaultCtx <> defaultCtx
defaultCtx :: Context String defaultCtx :: Context String

47
sitemap.xml Normal file
View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
<url>
<loc>http://weirdnatto.in/</loc>
<lastmod>2022-05-12T14:58:07+00:00</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>http://weirdnatto.in/about.html</loc>
<lastmod>2022-05-12T14:58:07+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://weirdnatto.in/contact.html</loc>
<lastmod>2022-05-12T14:58:07+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://weirdnatto.in/archive.html</loc>
<lastmod>2022-05-12T14:58:07+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://weirdnatto.in/posts/2022-12-05-placeholder.html</loc>
<lastmod>2022-05-12T14:58:07+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>http://weirdnatto.in/archive/tags.html</loc>
<lastmod>2022-05-12T14:58:07+00:00</lastmod>
<priority>0.64</priority>
</url>
<url>
<loc>http://weirdnatto.in/archive/tags/amaang.html</loc>
<lastmod>2022-05-12T14:58:12+00:00</lastmod>
<priority>0.64</priority>
</url>
</urlset>

View File

@@ -1,2 +1,3 @@
<p><a href="/archive/tags.html">Tags</a></p>
Here you can find all my previous posts: Here you can find all my previous posts:
$partial("templates/post-list.html")$ $partial("templates/post-list.html")$

View File

@@ -13,7 +13,6 @@
<a href="/">nattopages</a> <a href="/">nattopages</a>
</div> </div>
<nav> <nav>
<a href="/">Home</a>
<a href="/about.html">About</a> <a href="/about.html">About</a>
<a href="/contact.html">Contact</a> <a href="/contact.html">Contact</a>
<a href="/archive.html">Archive</a> <a href="/archive.html">Archive</a>
@@ -21,7 +20,6 @@
</header> </header>
<main role="main"> <main role="main">
<h1>$title$</h1>
$body$ $body$
</main> </main>

View File

@@ -1,7 +1,7 @@
<ul> <ul>
$for(posts)$ $for(posts)$
<li> <li>
<a href="$url$">$title$</a> - $date$ <a href="$url$">$title$</a> - $date$
</li> </li>
$endfor$ $endfor$
</ul> </ul>

View File

@@ -3,6 +3,9 @@
Posted on $date$ Posted on $date$
$if(author)$ $if(author)$
by $author$ by $author$
$endif$ <br>
$if(tags)$
Tags: $tags$
$endif$ $endif$
</section> </section>
<section> <section>

2
templates/tag.html Normal file
View File

@@ -0,0 +1,2 @@
Here are all the posts marked with tag $tag$:
$partial("templates/post-list.html")$

6
templates/tags.html Normal file
View File

@@ -0,0 +1,6 @@
$if(tags)$
Here is a list of all the tags:
<div class="tags"><p>$tags$</p></div>
$else$
There are no tags
$endif$