From f4c7bfd959a847cddba8e64e3637bb951f4c1621 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Mon, 18 Dec 2023 05:40:26 +0100 Subject: [PATCH] Added: sitemap.xml, robots.txt Fixed: Removing unwanted pages for each post --- .gitea/workflows/build_and_deploy.yaml | 3 +++ delete_pages.sh | 20 ++++++++++++++++++++ templates/robots.txt | 4 ++++ templates/sitemap.xml | 8 ++++++++ 4 files changed, 35 insertions(+) create mode 100755 delete_pages.sh create mode 100644 templates/robots.txt create mode 100644 templates/sitemap.xml diff --git a/.gitea/workflows/build_and_deploy.yaml b/.gitea/workflows/build_and_deploy.yaml index 9479652..b83b301 100644 --- a/.gitea/workflows/build_and_deploy.yaml +++ b/.gitea/workflows/build_and_deploy.yaml @@ -22,6 +22,9 @@ jobs: - name: Build Zola Website run: | zola build + + - name: Remove unwanted pages + run: bash ./delete_pages.sh - name: Set Destination Folder if MASTER if: ${{ github.ref == 'refs/heads/master' }} diff --git a/delete_pages.sh b/delete_pages.sh new file mode 100755 index 0000000..898a444 --- /dev/null +++ b/delete_pages.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +content_dir="./content" +public_dir="./public" + +cp "$sitemap_file" "$temp_sitemap_file" + +for file in "$content_dir"/*; do + file_name=$(basename "$file") + folder_name="${file_name%.*}" + folder_name_dashed=$(echo "$folder_name" | tr '_' '-') + folder_path="$public_dir/$folder_name_dashed" + + if [ -d "$folder_path" ]; then + rm -r "$folder_path" + echo "Removed: $folder_path" + else + echo "Folder not found: $folder_path" + fi +done diff --git a/templates/robots.txt b/templates/robots.txt new file mode 100644 index 0000000..6774d52 --- /dev/null +++ b/templates/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: +Allow: / +Sitemap: https://www.pkmples.cz/sitemap.xml \ No newline at end of file diff --git a/templates/sitemap.xml b/templates/sitemap.xml new file mode 100644 index 0000000..6938ea1 --- /dev/null +++ b/templates/sitemap.xml @@ -0,0 +1,8 @@ + + + + https://www.pkmples.cz/ + daily + 1.0 + + \ No newline at end of file