From f4a3e2379e0a4c761a3ebc3d5519d212458c649c Mon Sep 17 00:00:00 2001 From: mohamad Date: Sun, 26 Jan 2025 02:04:29 +0100 Subject: [PATCH] =?UTF-8?q?weeee=F0=9F=92=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yml | 25 +++++++++++++++++++++++++ assets/css/style.css | 26 ++++++++++++++++++++++++++ posts/first-post.md | 12 ++++++++++++ scripts/build.sh | 32 ++++++++++++++++++++++++++++++++ templates/index.html | 15 +++++++++++++++ templates/post.html | 23 +++++++++++++++++++++++ 6 files changed, 133 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 assets/css/style.css create mode 100644 posts/first-post.md create mode 100644 scripts/build.sh create mode 100644 templates/index.html create mode 100644 templates/post.html diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..0b9883d --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,25 @@ +name: Build and Deploy Blog +on: [push] + +jobs: + build: + runs-on: docker + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Pandoc + run: | + apt-get update + apt-get install -y pandoc + + - name: Build site + run: | + chmod +x scripts/build.sh + ./scripts/build.sh + + - name: Deploy to Pages + uses: actions/pages@v1 + with: + target: 'public' + keep_files: false \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..7d022ac --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,26 @@ +body { + font-family: Arial, sans-serif; + line-height: 1.6; + max-width: 800px; + margin: 0 auto; + padding: 20px; +} + +header { + border-bottom: 1px solid #ccc; + margin-bottom: 30px; + padding-bottom: 10px; +} + +nav a { + margin-right: 15px; + text-decoration: none; + color: #333; +} + +footer { + margin-top: 50px; + border-top: 1px solid #ccc; + padding-top: 10px; + color: #666; +} \ No newline at end of file diff --git a/posts/first-post.md b/posts/first-post.md new file mode 100644 index 0000000..897e0f4 --- /dev/null +++ b/posts/first-post.md @@ -0,0 +1,12 @@ +# My First Blog Post + +Welcome to my blog! This is my first post. + +## Subheading + +Here's some content: +- List item 1 +- List item 2 +- List item 3 + +**Bold text** and *italic text* \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..7b20f37 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Create public directory if not exists +mkdir -p public + +# Copy assets +cp -r assets public/ + +# Process posts +for post in posts/*.md; do + # Get base name + filename=$(basename "$post" .md) + + # Convert markdown to HTML + pandoc "$post" \ + --template templates/post.html \ + --metadata pagetitle="$(head -n 1 "$post" | sed 's/# //')" \ + -o "public/${filename}.html" +done + +# Generate index page +echo "" > public/index.html +echo "" >> public/index.html +pandoc templates/index.html >> public/index.html +echo "" >> public/index.html +echo "" >> public/index.html \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..1401dae --- /dev/null +++ b/templates/index.html @@ -0,0 +1,15 @@ + + + + My Blog + + + +
+

Welcome to My Blog

+ +
+
+

Latest Posts

\ No newline at end of file diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..bf7b914 --- /dev/null +++ b/templates/post.html @@ -0,0 +1,23 @@ + + + + + + $pagetitle$ + + + +
+

My Blog

+ +
+
+ $body$ +
+ + + \ No newline at end of file