add magic file
This commit is contained in:
parent
6ebc36f9cb
commit
126945e017
1 changed files with 44 additions and 0 deletions
44
boh.config
Normal file
44
boh.config
Normal file
|
@ -0,0 +1,44 @@
|
|||
export site_name="Your Blog"
|
||||
|
||||
boh_pre_build() {
|
||||
echo "Build index"
|
||||
boh_blog_build_index
|
||||
}
|
||||
|
||||
boh_post_build() {
|
||||
echo "Moving posts"
|
||||
boh_blog_move_posts
|
||||
echo "Coping assets"
|
||||
if [ -d "$source_dir/_assets" ];then
|
||||
cp -R "$source_dir/_assets/"* "$destination_dir"
|
||||
fi
|
||||
}
|
||||
|
||||
boh_blog_move_posts(){
|
||||
cut_at=`echo "/$destination_dir/posts/" | fold -w 1 | grep / -c`
|
||||
for file in `ls $destination_dir/posts/*.html`; do
|
||||
base_date=`echo $file | cut -d / -f $cut_at | cut -d - -f -3`
|
||||
newpath="$destination_dir/posts/"`date --date="$base_date" "+%Y/%m/%d"`"/"
|
||||
mkdir -p $newpath
|
||||
newpath=$newpath`echo $file | rev | cut -d / -f 1 | rev | cut -d - -f 4-`
|
||||
mv $file $newpath
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
boh_blog_build_index(){
|
||||
cat <<EOF > "$source_dir/index.md"
|
||||
---
|
||||
layout: index
|
||||
---
|
||||
EOF
|
||||
cut_at=`echo "/$source_dir/posts/" | fold -w 1 | grep / -c`
|
||||
for file in `ls $source_dir/posts/*.md | sort -r`; do
|
||||
base_date=`echo $file | cut -d / -f $cut_at- | cut -d - -f -3`
|
||||
date=`date --date="$base_date" "+ %a %d, %b %Y"`
|
||||
link="/posts/"`date --date="$base_date" "+%Y/%m/%d"`"/"`echo $file | rev | cut -d / -f 1 | rev | sed 's/.md/.html/' | cut -d - -f 4-`
|
||||
frontmatter=`parse_frontmatter $file`
|
||||
eval $frontmatter
|
||||
echo "<li><span class=\"post-meta\">$date</span><h2><a class =\"post-link\" href=\"$link\">$title</a></h2></li>" >> "$source_dir/index.md"
|
||||
done
|
||||
}
|
Loading…
Reference in a new issue