Updates in _blogs

This commit is contained in:
Stig-Ørjan Smelror 2024-01-30 11:20:38 +01:00
parent 3fcf58b618
commit 227d4fbfb2

25
qsgen2
View File

@ -407,7 +407,18 @@ function _blogs() {
if (( ${#make_blog_array[@]} > 0 )); then if (( ${#make_blog_array[@]} > 0 )); then
# Regular blog creation process
if [[ ! ${mode} ]]; then
if [[ -f ${project_dir}/templates/${theme}/blogs.tpl ]]; then
local blog_tpl=$(<"${project_dir}/templates/${theme}/blogs.tpl")
else
echo "Unable to find theme template for Blogs."
exit
fi
for blog in "${make_blog_array[@]}"; do for blog in "${make_blog_array[@]}"; do
if (${debug}) echo "_blogs: Processing pre-data for ${blog}" if (${debug}) echo "_blogs: Processing pre-data for ${blog}"
local content="$(<"${blog}")" local content="$(<"${blog}")"
@ -427,20 +438,10 @@ function _blogs() {
blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}"
blog_url="${blog_dir}/${blog_index}.html" blog_url="${blog_dir}/${blog_index}.html"
# Regular blog creation process
if [[ ! ${mode} ]]; then
if [[ -f ${project_dir}/templates/${theme}/blogs.tpl ]]; then
local blog_tpl=$(<"${project_dir}/templates/${theme}/blogs.tpl")
else
echo "Unable to find theme template for Blogs."
exit
fi
for blog in "${make_blog_array[@]}"; do
if (${debug}) echo "_blogs: Processing ${blog}" if (${debug}) echo "_blogs: Processing ${blog}"
# Prepare the blog template # Prepare the blog template
if (${debug}) echo "_blogs: Processing substitutes in ${blog}"
local blog_content=$(echo "${blog_tpl}" | perl -pe "s|BLOGTITLE|${btitle}|g") local blog_content=$(echo "${blog_tpl}" | perl -pe "s|BLOGTITLE|${btitle}|g")
blog_content=$(echo "${blog_content}" | perl -pe "s|CALADAY|${sdate[1]}|g") blog_content=$(echo "${blog_content}" | perl -pe "s|CALADAY|${sdate[1]}|g")
blog_content=$(echo "${blog_content}" | perl -pe "s|CALNDAY|${sdate[4]}|g") blog_content=$(echo "${blog_content}" | perl -pe "s|CALNDAY|${sdate[4]}|g")
@ -492,7 +493,7 @@ function _blogs() {
export BLOG_URL="${www_root}${blog_url}" export BLOG_URL="${www_root}${blog_url}"
fi fi
done
else else
echo "${yellow}No new or updated Blogs detected.${end}" echo "${yellow}No new or updated Blogs detected.${end}"
fi fi