Files
hugo/setup-cross-platform.sh

167 lines
3.3 KiB
Bash
Executable File

#!/bin/bash
# Remove any previous setup to start fresh
rm -rf site
mkdir -p site
# Create hugo.yaml config file
cat > site/hugo.yaml << EOF
baseURL: "http://localhost:1313/"
languageCode: "en-us"
title: "Jens Bech's Blog"
theme: "PaperMod"
# Menu items
menu:
main:
- identifier: archive
name: Archive
url: /archive/
weight: 10
- identifier: categories
name: Categories
url: /categories/
weight: 20
- identifier: tags
name: Tags
url: /tags/
weight: 30
- identifier: search
name: Search
url: /search/
weight: 40
# PaperMod theme specific parameters
params:
# Theme appearance
defaultTheme: auto
disableThemeToggle: false
# Homepage settings
profileMode:
enabled: true
title: "Jens Bech"
subtitle: "Welcome to my minimalist blog"
imageUrl: "/images/profile.jpg"
buttons:
- name: Archive
url: "/archive/"
- name: Categories
url: "/categories/"
- name: Tags
url: "/tags/"
# Display settings
ShowReadingTime: true
ShowShareButtons: false
ShowPostNavLinks: true
ShowBreadCrumbs: true
ShowCodeCopyButtons: true
hideFooter: false
# Search settings
fuseOpts:
isCaseSensitive: false
shouldSort: true
location: 0
distance: 1000
threshold: 0.4
minMatchCharLength: 0
keys: ["title", "permalink", "summary", "content"]
EOF
# Create theme directory
mkdir -p site/themes
# Clone the PaperMod theme
git clone https://github.com/adityatelange/hugo-PaperMod site/themes/PaperMod
# Create search page
mkdir -p site/content
cat > site/content/search.md << EOF
---
title: "Search"
layout: "search"
summary: "search"
---
EOF
# Create archive page
cat > site/content/archive.md << EOF
---
title: "Archive"
layout: "archives"
url: "/archive/"
summary: "archives"
---
EOF
# Create example blog posts
mkdir -p site/content/posts
# Get current date - works on both systems
CURRENT_DATE=$(date +"%Y-%m-%d")
# Calculate tomorrow's date in a cross-platform way
# First try macOS syntax
if date -v+1d &>/dev/null; then
# macOS date command
TOMORROW=$(date -v+1d +"%Y-%m-%d")
elif date -d "+1 day" &>/dev/null; then
# Linux date command
TOMORROW=$(date -d "+1 day" +"%Y-%m-%d")
else
# Fallback - just use current date for both
TOMORROW=$CURRENT_DATE
fi
cat > site/content/posts/first-post.md << EOF
---
title: "My First Post"
date: ${CURRENT_DATE}
draft: false
tags: ["blog", "tech"]
categories: ["personal"]
author: "Jens Bech"
---
# Hello World!
This is my first blog post using the PaperMod theme. It's a clean, elegant theme with great features:
## Features
- Light/Dark mode toggle
- Clean design with good typography
- Mobile-friendly interface
- Fast loading times
- Search capability
- Archive view for browsing all posts
EOF
cat > site/content/posts/second-post.md << EOF
---
title: "Getting Started with Hugo"
date: ${TOMORROW}
draft: false
tags: ["hugo", "guide"]
categories: ["tutorials"]
author: "Jens Bech"
---
# Getting Started with Hugo
Hugo is an amazing static site generator that makes blogging a breeze!
## Why Hugo?
- Blazing fast performance
- Flexible content management
- Simple deployment
- Great theme ecosystem
EOF
# Create directory for images
mkdir -p site/static/images
echo "Hugo site with PaperMod theme properly set up! Now run the Docker container."