remove .html from posts
This commit is contained in:
parent
f710bc90aa
commit
883f94892c
10
blop
10
blop
|
@ -20,7 +20,7 @@ max_posts="10" # number of posts to list on the blog index, posts beyond this wi
|
|||
group_by_date=false # whether to group the main listing on the blog's index by dates
|
||||
date_format="%B %-d, %Y"
|
||||
short_date_format="%B, %Y" # format for date grouping in the archive and optionally on the index (see group_by_date above)
|
||||
listing_format="<a href=\"posts/<!--title-nospaces-->.html\"><!--title--></a> by <!--author--> on <!--date-->" # rejig this and/or remove elements to taste. You may need to change delimeter when sed is used on this later if any of the fields contain slashes
|
||||
listing_format="<a href=\"posts/<!--title-nospaces-->./\"><!--title--></a> by <!--author--> on <!--date-->" # rejig this and/or remove elements to taste. You may need to change delimeter when sed is used on this later if any of the fields contain slashes
|
||||
|
||||
#######################
|
||||
|
||||
|
@ -80,7 +80,8 @@ if [[ ! -d "$blogdir/posts/" ]]; then
|
|||
mkdir "$blogdir/posts/"
|
||||
else
|
||||
echo "Deleting old HTML files in $blogdir/posts/"
|
||||
find "$blogdir/posts/" -name "*.html" -type f -exec rm -f {} +
|
||||
#find "$blogdir/posts/" -name "*.html" -type f -exec rm -f {} +
|
||||
rm -rf $blogdir/posts/*
|
||||
fi
|
||||
rm -f "$blogdir/index.html" "$blogdir/rss.xml"
|
||||
|
||||
|
@ -123,6 +124,7 @@ for file in $(ls -t1 "$blogdir/markdown/"*.md); do
|
|||
author=$default_author
|
||||
fi
|
||||
echo "Making \"$title\""
|
||||
mkdir $blogdir/posts/$title_nospaces
|
||||
pandoc <<<$(sed '/^---$/,/^---$/d' $file) > "$temp"/post
|
||||
listitem=$(echo "$listing_format" | sed -e "s/<!--title-nospaces-->/$title_nospaces/g" -e "s/<!--title-->/$title/g" -e "s@<!--date-->@$date@g" -e "s/<!--author-->/$author/g" -e "s/<!--summary-->/$summary/g")
|
||||
if [[ "$max_posts" = "unlimited" ]] || [[ $postcount -le $max_posts ]]; then
|
||||
|
@ -135,7 +137,7 @@ for file in $(ls -t1 "$blogdir/markdown/"*.md); do
|
|||
fi
|
||||
fi
|
||||
postlist="$postlist<li>$listitem</li>\n"
|
||||
fi
|
||||
fi
|
||||
#Put it in the archive
|
||||
if [[ -z "$archivelist" ]]; then
|
||||
archivelist="<h3 class=\"archivedate\">$short_date</h3>\n<ul class=\"archivelist\">\n"
|
||||
|
@ -147,7 +149,7 @@ for file in $(ls -t1 "$blogdir/markdown/"*.md); do
|
|||
|
||||
sed -e "/<!--post-->/r $temp/post" -e '/<!--post-->/d' -e "s/<!--author-->/$author/g" -e "s/<!--date-->/$date/g" -e "s/<!--title-->/$title/g" "$blogdir/post_template.html" > "$blogdir/posts/$title_nospaces.html"
|
||||
# prepare rss
|
||||
echo -e "<item>\n<title>$title</title>\n<guid>$url/posts/$title_nospaces.html</guid>\n<pubDate>$rssdate</pubDate><description><![CDATA[$(cat $temp/post)]]></description>\n</item>\n\n" >> $temp/rss
|
||||
echo -e "<item>\n<title>$title</title>\n<guid>$url/posts/$title_nospaces/</guid>\n<pubDate>$rssdate</pubDate><description><![CDATA[$(cat $temp/post)]]></description>\n</item>\n\n" >> $temp/rss
|
||||
done
|
||||
|
||||
echo "Creating index.html"
|
||||
|
|
Loading…
Reference in New Issue