tweak: Give a preview of posts in main page

rather than pasting them all together.
This commit is contained in:
NunoSempere 2022-03-10 14:53:16 +00:00
parent c0aaa9c885
commit 982acb340f

View File

@ -83,7 +83,8 @@ fn blagh_body {
l=`{echo -n $p|sed 's!'$sitedir^'/?(.*)([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])(/[^/]+/)!\2 /\1\2\3!'} l=`{echo -n $p|sed 's!'$sitedir^'/?(.*)([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])(/[^/]+/)!\2 /\1\2\3!'}
sed '1s!.*![&]('^$l(2)^') ('^$l(1)^')!' < $p/index.md sed '1s!.*![&]('^$l(2)^') ('^$l(1)^')!' < $p/index.md
echo # Needed extra \n so markdown doesn't mess up the formatting, probably can be done in sed. echo # Needed extra \n so markdown doesn't mess up the formatting, probably can be done in sed.
} | $formatter } head -n 9 | $formatter | sed 's/h[2-9]/i/g'| sed 's/h1/h3/g'
# ^ take the first 9 lines of markdown, convert them to html. Then make h1->h3 and h_i -> cursive. This makes it more like a preview rather than all the posts pasted together.
# XXX BUG! Markdown [references] break because multiple markdown documents are merged. Should format each blog post independently. # XXX BUG! Markdown [references] break because multiple markdown documents are merged. Should format each blog post independently.
# TODO: use fltr_cache directly, that can fix the previous bug plus provide a perf boost by caching title generation. # TODO: use fltr_cache directly, that can fix the previous bug plus provide a perf boost by caching title generation.
} }