Skip to content
Snippets Groups Projects
Unverified Commit f15a2343 authored by Bob Mottram's avatar Bob Mottram
Browse files

Use previous blog post index when deleting

parent 74437ea5
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,8 @@ function delete_blog {
return
fi
CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX)
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${CURRENT_INDEX}_post.rst
PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.rst
if [ ! -f $LAST_BLOG_ENTRY ]; then
return
fi
......@@ -118,8 +119,10 @@ function delete_blog {
case $sel in
0) rm $LAST_BLOG_ENTRY
if [ $CURRENT_INDEX -gt 0 ]; then
CURRENT_INDEX=$((CURRENT_INDEX - 1))
CURRENT_INDEX=$PREVIOUS_INDEX
echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX
else
rm -f $CURRENT_BLOG_INDEX
fi
regenerate_blog
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment