From 4c014375e1a99c146e443c5ac24c6d21490e57ee Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 9 Oct 2019 18:47:32 +0100 Subject: [PATCH] feat: add Forestry.io integration --- .../front_matter/templates/blog-post.yml | 50 +++++++++++++ .forestry/front_matter/templates/event.yml | 71 +++++++++++++++++++ .forestry/settings.yml | 56 +++++++++++++++ config.toml | 1 + content/home/demo.md | 5 +- content/home/hero.md | 5 +- themes/academic | 2 +- update_academic.sh | 38 +++++----- 8 files changed, 204 insertions(+), 24 deletions(-) create mode 100644 .forestry/front_matter/templates/blog-post.yml create mode 100644 .forestry/front_matter/templates/event.yml create mode 100644 .forestry/settings.yml create mode 120000 config.toml diff --git a/.forestry/front_matter/templates/blog-post.yml b/.forestry/front_matter/templates/blog-post.yml new file mode 100644 index 0000000..369fcb8 --- /dev/null +++ b/.forestry/front_matter/templates/blog-post.yml @@ -0,0 +1,50 @@ +--- +label: Blog post +hide_body: false +fields: +- type: text + name: title + label: title +- type: text + name: subtitle + label: subtitle +- type: datetime + name: date + label: date +- type: list + name: authors + label: authors +- type: list + name: tags + label: tags +- type: text + name: summary + label: summary +- type: field_group + name: image + label: image + fields: + - type: number + name: placement + label: placement + - type: text + name: caption + label: caption + - type: text + name: focal_point + label: focal_point + description: Image Focal Point (Smart, Center, TopLeft, Top, TopRight, Left, Right, + BottomLeft, Bottom, BottomRight) +- name: projects + type: list + config: + use_select: false + min: + max: + label: projects + description: Associate this content with a project by entering a project folder + name +- name: featured + type: boolean + label: featured + description: You can filter by featured content on your homepage diff --git a/.forestry/front_matter/templates/event.yml b/.forestry/front_matter/templates/event.yml new file mode 100644 index 0000000..f4943c0 --- /dev/null +++ b/.forestry/front_matter/templates/event.yml @@ -0,0 +1,71 @@ +--- +label: Event +hide_body: true +fields: +- type: text + name: title + label: title +- name: subtitle + type: text + config: + required: false + label: subtitle +- type: text + name: event + label: event + description: Name of the event (e.g. Academic Conference) +- type: text + name: event_url + label: Event Link +- type: text + name: location + label: location +- type: datetime + name: publishDate + label: publishDate + description: When to publish this page (choose today) +- type: datetime + name: date + label: date + description: Start time +- type: datetime + name: date_end + label: date_end + description: End time +- type: boolean + name: all_day + label: all_day +- type: list + name: authors + label: Presenters +- type: textarea + name: abstract + label: abstract +- type: text + name: url_slides + label: url_slides +- type: text + name: url_video + label: url_video +- type: text + name: url_code + label: url_code +- type: field_group + name: image + label: image + fields: + - type: number + name: placement + label: placement + - type: text + name: caption + label: caption + - type: text + name: focal_point + label: focal_point + description: Image Focal Point (Smart, Center, TopLeft, Top, TopRight, Left, Right, + BottomLeft, Bottom, BottomRight) +- name: featured + type: boolean + label: featured + description: You can filter by featured content on your homepage diff --git a/.forestry/settings.yml b/.forestry/settings.yml new file mode 100644 index 0000000..eaa45d3 --- /dev/null +++ b/.forestry/settings.yml @@ -0,0 +1,56 @@ +--- +new_page_extension: md +auto_deploy: false +admin_path: +webhook_url: +sections: +- type: directory + path: content/home + label: Home + create: all + match: "**/*" +- type: directory + path: content/post + label: Blog posts + create: all + match: "**/*" + templates: + - blog-post +- type: directory + path: content/project + label: Projects + create: all + match: "**/*" +- type: directory + path: content/talk + label: Events + create: all + match: "**/*" + templates: + - event +- type: directory + path: content/publication + label: Publications + create: all + match: "**/*" +- type: directory + path: content + label: Pages + create: all + match: "*" +upload_dir: static/img +public_path: "/img" +front_matter_path: '' +use_front_matter_path: false +file_template: ":filename:" +build: + preview_env: + - HUGO_ENV=staging + - HUGO_VERSION=0.58.2 + preview_output_directory: public + preview_docker_image: forestryio/hugo:latest + mount_path: "/srv" + working_dir: "/srv" + instant_preview_command: hugo server -D -E -F --port 8080 --bind 0.0.0.0 --renderToDisk + -d public +version: 0.58.2 diff --git a/config.toml b/config.toml new file mode 120000 index 0000000..abf509f --- /dev/null +++ b/config.toml @@ -0,0 +1 @@ +./config/_default/config.toml \ No newline at end of file diff --git a/content/home/demo.md b/content/home/demo.md index cbd5cc6..54800cf 100644 --- a/content/home/demo.md +++ b/content/home/demo.md @@ -31,7 +31,10 @@ subtitle = "" # Background image. # image = "image.jpg" # Name of image in `static/img/`. # image_darken = 0.6 # Darken the image? Range 0-1 where 0 is transparent and 1 is opaque. - + # image_size = "cover" # Options are `cover` (default), `contain`, or `actual` size. + # image_position = "center" # Options include `left`, `center` (default), or `right`. + # image_parallax = true # Use a fun parallax-like fixed background effect? true/false + # Text color (true=light or false=dark). text_color_light = true diff --git a/content/home/hero.md b/content/home/hero.md index 7f57c23..0b80dda 100644 --- a/content/home/hero.md +++ b/content/home/hero.md @@ -26,7 +26,10 @@ hero_media = "hero-academic.png" # Background image. # image = "" # Name of image in `static/img/`. # image_darken = 0.6 # Darken the image? Range 0-1 where 0 is transparent and 1 is opaque. - + # image_size = "cover" # Options are `cover` (default), `contain`, or `actual` size. + # image_position = "center" # Options include `left`, `center` (default), or `right`. + # image_parallax = true # Use a fun parallax-like fixed background effect? true/false + # Text color (true=light or false=dark). text_color_light = true diff --git a/themes/academic b/themes/academic index 3911b8f..d8e90e9 160000 --- a/themes/academic +++ b/themes/academic @@ -1 +1 @@ -Subproject commit 3911b8ff5327a8f703bd88d2c53db1c116b75614 +Subproject commit d8e90e9d649c6ce86eb0b71ad20b6c4953298177 diff --git a/update_academic.sh b/update_academic.sh index a59f5b6..74ace43 100755 --- a/update_academic.sh +++ b/update_academic.sh @@ -12,15 +12,26 @@ if [ ! -d .git ]; then exit 1; fi +function view_update () { + echo -e "Checking for updates...\n" + cd themes/academic + git fetch + git log --pretty=oneline --abbrev-commit --decorate HEAD..origin/master + cd ../../ +} + # Function to update Academic -function install_update () { +function do_update () { # Apply any updates git submodule update --remote --merge # - Update Netlify.toml with required Hugo version if [ -f ./netlify.toml ]; then - version=$(sed -n 's/^min_version = //p' themes/academic/theme.toml) - sed -i '' -e "s/HUGO_VERSION = .*/HUGO_VERSION = $version/g" ./netlify.toml + # Postfix '.0' to Hugo min_version as sadly it doesn't map to a precise semantic version. + version=$(sed -n 's/^min_version = //p' themes/academic/theme.toml | tr -d '"') + version="${version}.0" + echo "Set Netlify Hugo version to v${version}" + sed -i '' -e "s/HUGO_VERSION = .*/HUGO_VERSION = \"$version\"/g" ./netlify.toml fi echo @@ -34,22 +45,7 @@ version=$(sed -n 's/^version = "//p' themes/academic/data/academic.toml) echo -e "Source Themes Academic v$version\n" # Display available updates -echo -e "Checking for updates...\n" -cd themes/academic -git fetch -git log --pretty=oneline --abbrev-commit --decorate HEAD..origin/master -cd ../../ +view_update -title="Do you wish to install the above updates?" -prompt="Choose an option and press Enter:" -options=("Yes" "No") - -echo "$title" -PS3="$prompt " -select opt in "${options[@]}"; do - case $opt in - Yes ) install_update; break;; - No ) break;; - * ) break;; - esac -done +# Apply any updates +do_update