Browse Source

feat: add Forestry.io integration

master
George Cushen 2 years ago
parent
commit
4c014375e1
  1. 50
      .forestry/front_matter/templates/blog-post.yml
  2. 71
      .forestry/front_matter/templates/event.yml
  3. 56
      .forestry/settings.yml
  4. 1
      config.toml
  5. 5
      content/home/demo.md
  6. 5
      content/home/hero.md
  7. 2
      themes/academic
  8. 40
      update_academic.sh

50
.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

71
.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

56
.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

1
config.toml

@ -0,0 +1 @@
./config/_default/config.toml

5
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

5
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

2
themes/academic

@ -1 +1 @@
Subproject commit 3911b8ff5327a8f703bd88d2c53db1c116b75614
Subproject commit d8e90e9d649c6ce86eb0b71ad20b6c4953298177

40
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 ../../
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
view_update
# Apply any updates
do_update
Loading…
Cancel
Save