This commit is contained in:
despiegk 2025-07-30 12:11:27 +02:00
parent 479f73e813
commit 29a965f824
3 changed files with 132 additions and 26 deletions

View File

@ -1,34 +1,33 @@
PREFIX="mycelium"
echo "Starting build..." echo "Starting build..."
SOURCE=${BASH_SOURCE[0]} SOURCE=${BASH_SOURCE[0]}
DIR_OF_THIS_SCRIPT="$( dirname "$SOURCE" )" DIR_OF_THIS_SCRIPT="$( dirname "$SOURCE" )"
ABS_DIR_OF_SCRIPT="$( realpath $DIR_OF_THIS_SCRIPT )" ABS_DIR_OF_SCRIPT="$( realpath $DIR_OF_THIS_SCRIPT )"
# TODO: Check if current version is latest to avoid redundant installation # Check if tailwindcss executable exists, if not, download and install it
if [[ -f "tailwindcss" ]] if [[ ! -f "tailwindcss" ]]; then
then echo "Installing & building tailwind..."
rm tailwindcss ASSET="tailwindcss"
fi
# checks os and architecture for correct release if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# https://stackoverflow.com/a/8597411 ASSET="$ASSET-linux"
echo "Installing & building tailwind..." elif [[ "$OSTYPE" == "darwin"* ]]; then
ASSET="tailwindcss" ASSET="$ASSET-macos"
fi
if [[ "$(uname -m)" == "x86_64"* ]]; then
ASSET="$ASSET-x64"
elif [[ "$(uname -m)" == "arm64"* ]]; then
ASSET="$ASSET-arm64"
fi
if [[ "$OSTYPE" == "linux-gnu"* ]]; then curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.17/${ASSET}"
ASSET="$ASSET-linux" chmod +x $ASSET
elif [[ "$OSTYPE" == "darwin"* ]]; then mv $ASSET tailwindcss
ASSET="$ASSET-macos" else
echo "tailwindcss already exists, skipping installation."
fi fi
if [[ "$(uname -m)" == "x86_64"* ]]; then
ASSET="$ASSET-x64"
elif [[ "$(uname -m)" == "arm64"* ]]; then
ASSET="$ASSET-arm64"
fi
curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.17/${ASSET}"
chmod +x $ASSET
mv $ASSET tailwindcss
# initialized and configures tailwind if not configured # initialized and configures tailwind if not configured
@ -43,6 +42,15 @@ fi
echo "Compiling tailwindcss and building zola project..." echo "Compiling tailwindcss and building zola project..."
rm -rf public static/css rm -rf public static/css
./tailwindcss -i css/index.css -o ./static/css/index.css --minify ./tailwindcss -i css/index.css -o ./static/css/index.css --minify
zola --root $ABS_DIR_OF_SCRIPT build
rsync -rav --delete public/ ${HOME}/hero/var/www/mycelium/
# echo "Building without prefix..."
# sed 's|base_url = "BASEURL"|base_url = "https://www.mycelium.threefold.io/"|' config.templ.toml > config.toml
# zola --root $ABS_DIR_OF_SCRIPT build
# rsync -avz --delete public/ "root@threefold.info:/root/hero/www/info/$PREFIX/"
echo "Building with prefix: /$PREFIX/"
sed 's|base_url = "BASEURL"|base_url = "/mycelium/"|' config.templ.toml > config.toml
zola --root $ABS_DIR_OF_SCRIPT build
rsync -rav --delete public/ "${HOME}/hero/var/www/$PREFIX/"
rsync -avz --delete public/ "root@threefold.info:/root/hero/www/info/$PREFIX/"

99
config.templ.toml Normal file
View File

@ -0,0 +1,99 @@
# The URL the site will be built for
base_url = "BASEURL"
title = "Mycelium"
description = "Our global digital backbone"
# When set to "true", a feed is automatically generated.
# generate_feed = true
# The filename to use for the feed. Used as the template filename, too.
# Defaults to "atom.xml", which has a built-in template that renders an Atom 1.0 feed.
# There is also a built-in template "rss.xml" that renders an RSS 2.0 feed.
# feed_filename = "atom.xml"
# The number of articles to include in the feed. All items are included if
# this limit is not set (the default).
# feed_limit = 10
# Whether to automatically compile all Sass files in the sass directory
compile_sass = false
# When set to "true", the generated HTML files are minified.
# minify_html = true
# I'm keeping off for now -- buggy -- 2021-02-05 (@keats says it'll be fixed 0.14.0)
# Whether to build a search index to be used later on by a JavaScript library
build_search_index = false
[markdown]
# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
highlight_code = true
highlight_theme = "visual-studio-dark"
# When set to "true", emoji aliases translated to their corresponding
# Unicode emoji equivalent in the rendered Markdown files. (e.g.: :smile: => 😄)
render_emoji = false
# Whether external links are to be opened in a new tab
# If this is true, a `rel="noopener"` will always automatically be added for security reasons
# external_links_target_blank = false
# Whether to set rel="nofollow" for all external links
external_links_no_follow = true
# Whether to set rel="noreferrer" for all external links
external_links_no_referrer = true
# Whether smart punctuation is enabled (changing quotes, dashes, dots in their typographic form)
# For example, `...` into `…`, `"quote"` into `“curly”` etc
smart_punctuation = true
#[build]
#not_found = "404.md"
[[taxonomies]]
name = "categories"
feed = true
paginate_by = 6
paginate_path = "blog-posts"
[[taxonomies]]
name = "partners-category"
feed = true
paginate_by = 6
paginate_path = "partner-card"
[[taxonomies]]
name = "news-category"
feed = true
paginate_by = 6
paginate_path = "news-card"
[[taxonomies]]
name = "roles"
feed = true
paginate_by = 2
paginate_path = "join-us"
[[taxonomies]]
name = "tags"
feed = true
paginate_by = 9
paginate_path = "tags"
[[taxonomies]]
name = "people"
feed = false
paginate_by = 9
paginate_path = "people"
[[taxonomies]]
name = "memberships"
feed = false
paginate_by = 8
paginate_path = "people/memberships"
[extra]
# Put all your custom variables here

View File

@ -1,6 +1,5 @@
# The URL the site will be built for # The URL the site will be built for
base_url = "https://www2.mycelium.threefold.io/" base_url = "/mycelium/"
# Change this to your own URL! Please note this variable **must** be uncommented .
title = "Mycelium" title = "Mycelium"
description = "Our global digital backbone" description = "Our global digital backbone"