Fix date, add nav/footer to blogindex

This commit is contained in:
Arya Kiran 2022-09-09 19:33:56 +05:30
parent dcaad8d30a
commit fa38cb5144
No known key found for this signature in database
GPG Key ID: 3A6EA2D0EE314EEF
5 changed files with 19 additions and 9 deletions

View File

@ -15,8 +15,8 @@ HTML_LANG="en_US" # Your document (HTML) language setting
TOC=true
SYNTAX=true
POSTS_DIR="posts/"
POSTS=$(find $POSTS_DIR -type f -name *.md)
POSTS=$(find $POSTS_DIR -type f)
WEB_HTML="blog/"
OUTPUT="_output/"
TIME=$(date +"%T %Z")
TIME=$(date -u +"%T %z")
TTL="60"

View File

@ -2,8 +2,11 @@
.PHONY: build
build:
rm -rf _output
mkdir -p _output/blog
bash pblog.sh > _output/blog/feed.xml
xsltproc _output/blog/feed.xml > _output/blog/index.html
bash sed.sh
serve: build
python3 -m http.server --directory _output/

View File

@ -1,7 +1,6 @@
#!/bin/sh
source _config.sh
###################################################################################
# !WARNING!
# You probably don't need to tweak anything below this line. Edit at your own risk!
@ -31,8 +30,6 @@ rsync $POSTS_DIR*.html $OUTPUT$WEB_HTML;
rm $POSTS_DIR*.html
# Remove the default blog index to avoid pulling into the XML feed
rm $OUTPUT$WEB_HTML/index.html
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<?xml-stylesheet href=\"rss.xsl\" type=\"text/xsl\"?>
<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
@ -55,8 +52,8 @@ then
CAT_DATE=$(gdate -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")
POST_DATE=$(gdate -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y")
else
CAT_DATE=$(date -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")
POST_DATE=$(date -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y")
CAT_DATE=$(date -u -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")
POST_DATE=$(date -u -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y")
fi
echo "<item>

4
sed.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
sed -i -e 's/<header>//' -e 's/<\/header>//' -e 's/<body>/<body>\n<\!--#include file=\"\/nav\"-->\n/' -e 's/<\/body>/<\/body>\n<!--#include file=\"\/footer\"-->\n/' -e 's/..\/..\/style.css/\/blog\/style.css/' _output/blog/index.html
sed -i -n '1,/<style>/p;/<\/style>/,$p' _output/blog/index.html

View File

@ -123,7 +123,13 @@ pre {
padding: 5px;
position: relative;
}
.date {
color: grey;
//color: grey;
display: block;
font-family: monospace;
margin-top: 1em;
overflow: hidden;
white-space: nowrap;
width: 16ch;
}