From 3fcf58b618810cd0d74b5c721028d45feddc4ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Tue, 30 Jan 2024 11:09:55 +0100 Subject: [PATCH] Updates in _blogs --- qsgen2 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/qsgen2 b/qsgen2 index eabac66..fecb4f3 100755 --- a/qsgen2 +++ b/qsgen2 @@ -430,7 +430,12 @@ function _blogs() { # Regular blog creation process if [[ ! ${mode} ]]; then - local blog_tpl=$(<"${project_dir}/templates/${theme}/blogs.tpl") + 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}" @@ -451,9 +456,20 @@ function _blogs() { # Apply transformations blog_content="$(_html "${blog_content}")" - blog_content="$(_link "${blog_content}")" - blog_content="$(_image "${blog_content}")" - blog_content="$(_youtube "${blog_content}")" + # Look for links, images and videos and convert them if present. + if (${debug}) echo "_pages: Checking for #link, #showimg and #ytvideo in blog_content" + if [[ $( echo ${blog_content} | grep \#link ) ]]; then + if (${debug}) echo "_blogs: If #link is present, run _link: blog_content" + blog_content="$(_link "${blog_content}")" + fi + if [[ $( echo ${blog_content} | grep \#showimg ) ]]; then + if (${debug}) echo "_blogs: If #showimg is present, run _link: blog_content" + blog_content="$(_image "${blog_content}")" + fi + if [[ $( echo ${blog_content} | grep \#ytvideo ) ]]; then + if (${debug}) echo "_blogs: If #ytvideo is present, run _link: blog_content" + blog_content="$(_youtube "${blog_content}")" + fi blog_content="$(_cleanup "${blog_content}")" blog_content="$(_last_updated "${blog_content}")"