From 1e257680f52d698716786b5a467d811c6cc334d7 Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Sat, 29 Jul 2023 14:19:09 +0100 Subject: [PATCH] Build using layout file --- +layout.html | 22 ++++++++++++++++++++++ .github/workflows/build.yml | 8 +++++++- .gitignore | 1 + compile.sh | 32 ++++++++++++++++++++++++++++++++ hosting.html | 37 ------------------------------------- hosting.page | 20 ++++++++++++++++++++ index.html | 31 ------------------------------- index.page | 15 +++++++++++++++ 8 files changed, 97 insertions(+), 69 deletions(-) create mode 100644 +layout.html create mode 100644 .gitignore create mode 100755 compile.sh delete mode 100644 hosting.html create mode 100644 hosting.page delete mode 100644 index.html create mode 100644 index.page diff --git a/+layout.html b/+layout.html new file mode 100644 index 0000000..32e31b1 --- /dev/null +++ b/+layout.html @@ -0,0 +1,22 @@ + + + + + + + {{head}} + + +
+

🍉 - 1f349.net

+

+ Home +  -  + Hosting +  -  + Admin +

+
+ {{page}} + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c79cdb..7d7c8c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,8 +10,14 @@ jobs: - name: Check out Git repository uses: actions/checkout@v1 + - run: sudo apt-get update + - run: sudo apt-get install yq + + - name: Build + run: ./compile.sh + - name: Archive - run: tar -czvf upload.tar.gz -C . * + run: tar -czvf upload.tar.gz -C ./build . - name: Release run: 'curl -X POST -H "Authorization: Bearer ${{ secrets.DEPLOY }}" -F "upload=@upload.tar.gz" "https://sites.1f349.net/u?site=1f349.net&branch=${{ github.ref_name }}"' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..4f59f38 --- /dev/null +++ b/compile.sh @@ -0,0 +1,32 @@ +#!/bin/bash +function mp() { + echo " " +} + +rm -rf "build/" +find . -name '*.page' -print0 | + while IFS= read -r -d '' ff; do + d=`dirname "$ff"` + f2=`basename "$ff"` + f3="${f2%.page}.html" # build filename + echo "Writing $ff -> $f3" + mkdir -p "build/$d" + exec 3<> "build/$d/$f3" + while IFS= read -r p; do + a=`echo "$p" | tr -d '[:space:]'` + if [ "$a" == "{{head}}" ]; then + echo " $(yq -r '.meta.title' "$ff")" >&3 + echo " " >&3 + mp "og:title" "$(yq -r '.meta.og-title' "$ff")" >&3 + mp "og:url" "$(yq -r '.meta.og-url' "$ff")" >&3 + mp "og:type" "$(yq -r '.meta.og-type' "$ff")" >&3 + mp "og:image" "$(yq -r '.meta.og-image' "$ff")" >&3 + mp "og:site_name" "$(yq -r '.meta.og-site_name' "$ff")" >&3 + elif [ "$a" == "{{page}}" ]; then + yq -r '.content' "$ff" >&3 + else + echo "$p" >&3 + fi + done < "+layout.html" + exec 3>&- + done diff --git a/hosting.html b/hosting.html deleted file mode 100644 index f6637c8..0000000 --- a/hosting.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - Hosting | 1f349.net - - - - - - - - -
-

🍉 - 1f349.net Hosting

-

- Home -  -  - Hosting -  -  - Admin -

-

We are currently hosting the following domains

- -
- - diff --git a/hosting.page b/hosting.page new file mode 100644 index 0000000..79b6c3f --- /dev/null +++ b/hosting.page @@ -0,0 +1,20 @@ +meta: + title: "1f349.net Hosting" + author: "1f349.net" + og-title: "1f349.net Hosting" + og-url: "https://1f349.net/hosting" + og-type: "object" + og-image: "https://1f349.net/1f349.svg" + og-site_name: "1f349.net" +content: | +
+

We are currently hosting the following domains

+ +
diff --git a/index.html b/index.html deleted file mode 100644 index 7326523..0000000 --- a/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - 1f349.net - - - - - - - - -
-

🍉 - 1f349.net

-

- Home -  -  - Hosting -  -  - Admin -

-
U+1F349: WATERMELON
-Miscellaneous Symbols and Pictographs, U+1F300 - U+1F5FF
-Supplementary Multilingual Plane, U+10000 - U+1FFFF
-

The internal domain for all Melon-hosted services.

-
- - diff --git a/index.page b/index.page new file mode 100644 index 0000000..0d067ff --- /dev/null +++ b/index.page @@ -0,0 +1,15 @@ +meta: + title: "1f349.net" + author: "1f349.net" + og-title: "1f349.net" + og-url: "https://1f349.net" + og-type: "object" + og-image: "https://1f349.net/1f349.svg" + og-site_name: "1f349.net" +content: | +
+
U+1F349: WATERMELON
+  Miscellaneous Symbols and Pictographs, U+1F300 - U+1F5FF
+  Supplementary Multilingual Plane, U+10000 - U+1FFFF
+

The internal domain for all Melon-hosted services.

+