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 {
border-bottom: 0.2rem solid #000;
margin: 4.2rem 0;
}
nav {
text-align: right;
text-align: center;
margin: 0 auto 3rem;
}
nav a {
@@ -34,6 +36,11 @@ nav a {
text-transform: uppercase;
}
nav a:hover {
color: pink;
}
footer {
margin-top: 3rem;
padding: 1.2rem 0;
@@ -56,9 +63,19 @@ article .header {
color: #555;
}
.logo {
text-align: center;
margin: 1rem auto 3rem;
}
.logo a:hover {
transform: rotate(180deg);
}
.logo a {
font-weight: bold;
font-family: "Monoid Bold";
font-size: 3rem;
color: #000;
text-decoration: none;
}
@@ -82,27 +99,18 @@ article .header {
margin: 0;
padding: 0 5%;
}
header {
margin: 4.2rem 0;
}
nav {
margin: 0 auto 3rem;
text-align: center;
}
footer {
text-align: center;
}
.logo {
text-align: center;
margin: 1rem auto 3rem;
}
.logo a {
font-size: 2.4rem;
}
nav a {
display: block;
line-height: 1.6;
}
.sticky {
position: fixed;
top: 0;
background: white;
}
}
@media (min-width: 320px) {
@@ -111,23 +119,9 @@ article .header {
margin: 0;
padding: 0 5%;
}
header {
margin: 4.2rem 0;
}
nav {
margin: 0 auto 3rem;
text-align: center;
}
footer {
text-align: center;
}
.logo {
text-align: center;
margin: 1rem auto 3rem;
}
.logo a {
font-size: 2.4rem;
}
nav a {
display: inline;
margin: 0 0.6rem;
@@ -140,14 +134,6 @@ article .header {
margin: 0 auto;
padding: 0;
}
header {
margin: 0 0 3rem;
padding: 1.2rem 0;
}
nav {
margin: 0;
text-align: right;
}
nav a {
margin: 0 0 0 1.2rem;
display: inline;
@@ -155,12 +141,4 @@ article .header {
footer {
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
tags: amaang
---
this is so true
* 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 #-}
import Data.Monoid (mappend)
import Hakyll
--------------------------------------------------------------------------------
@@ -22,12 +21,44 @@ main = hakyllWith config $ do
>>= loadAndApplyTemplate "templates/default.html" defaultCtx
>>= 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
route $ setExtension "html"
compile $
pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/post.html" (postCtx tags)
>>= loadAndApplyTemplate "templates/default.html" (postCtx tags)
>>= relativizeUrls
create ["archive.html"] $ do
@@ -35,7 +66,7 @@ main = hakyllWith config $ do
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx =
listField "posts" postCtx (return posts)
listField "posts" (postCtx tags) (return posts)
<> constField "title" "Archives"
<> defaultCtx
@@ -49,7 +80,7 @@ main = hakyllWith config $ do
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let indexCtx =
listField "posts" postCtx (return posts)
listField "posts" (postCtx tags) (return posts)
<> defaultCtx
getResourceBody
@@ -69,9 +100,10 @@ config =
previewPort = 3333
}
postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y"
postCtx :: Tags -> Context String
postCtx tags =
tagsField "tags" tags
<> dateField "date" "%B %e, %Y"
<> defaultCtx
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:
$partial("templates/post-list.html")$

View File

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

View File

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

View File

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