1 - Nextcloud Collectives and Hugo SSG
Result #
All the errors were were corrected and the site is working just fine now! Here are the results of the Workflow:
1. Front Matter #
FRONTMATTER START
title: "Nextcloud Collectives and Hugo SSG"
description: "My experience with using Nextcloud Collectives and Hugo Static Site Generator."
draft: false
tags:
- "Go"
- "Nextcloud"
- "Collectives"
- "Hugo"
- "Static Site Generator"
date: "2024-12-27"
categories:
- "Hugo"
- "Nextcloud"
menu: "main"
author: "Vincent Maule"
type: posts
FRONTMATTER END
2. Copy Files from Nextcloud Collective #
#! /run/current-system/sw/bin/bash
cd ..
git submodule init
git submodule update
cd themes/hugo-book
git checkout e104a11f42fbd069aa15606c5f01631b07d7528c
cd ../..
rm -rf content/*
echo "Copying Files..."
cp -r ~/Nextcloud/Collectives/tech_fish-maule_com/* content
echo "Moving to Content Directory: " && pwd
cd content
echo "Renaming all Readme.md files..."
find . -depth -name "Readme.md" -exec sh -c 'f="{}"; mv -- "$f" "${f%Readme.md}_index.md"';
echo "Replacing Front Matter for all files where applicable..."
# Function to replace frontmatter
replace_frontmatter() {
local file="$1"
# Read the file content
local content=$(cat "$file")
# Check if the old frontmatter format exists
if [[ "$content" =~ "FRONTMATTER START" && "$content" =~ "FRONTMATTER END" ]]; then
# Replace the old format with the new one
content="${content/FRONTMATTER START/---}"
content="${content/FRONTMATTER END/---}"
# Write the modified content back to the file
echo "$content" > "$file"
echo "Updated frontmatter in $file"
fi
}
# Find all .md files in the current directory and its subdirectories
find . -type f -name "*.md" | while read -r file; do
replace_frontmatter "$file"
done
echo "Frontmatter conversion process completed."
3. Git Push #
#!/run/current-system/sw/bin/bash
cd ..
rm tech_fish-maule_com.tar.gz
rm -rf public
git add .
git commit -a -m "Perform Initial Commit attempt 7."
git push
4. Generate Sites #
#! /run/current-system/sw/bin/bash
cd ..
hugo --gc --minify
tar -czf tech_fish-maule_com.tar.gz public/*
Experience #
Timeline: December 24, 2024 - January 1, 2025
...