From 0810ee024f08790ce3fcbf4cc2c6dd1b0fa31ca7 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 8 Jul 2019 13:13:22 +0100 Subject: [PATCH] feat: enable pages to be edited on GitHub `edit_page` option can be added to `params.toml`. For example, `edit_page = {repo_url = "https://github.com/gcushen/hugo-academic", editable = {docs = true}}` Currently works for GitHub repos and pages using the `docs` layout. --- exampleSite/config/_default/params.toml | 10 +++++++--- i18n/en.yaml | 3 +++ layouts/_default/baseof.html | 2 +- layouts/partials/docs_layout.html | 10 +++++++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 39242f7d..1e08eb6d 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -2,13 +2,13 @@ # Documentation: https://sourcethemes.com/academic/ # Color theme. -# Choose from `default`, `ocean`, `forest`, `dark`, `apogee`, `1950s`, `coffee`, `cupcake`, `strawberry`. +# Choose from `default`, `ocean`, `forest`, `dark`, `apogee`, `1950s`, `coffee`, `rose`, `strawberry`, `mr_robot`. color_theme = "default" # Enable users to switch between day and night mode? day_night = true # Font style. -# Choose from `default`, `classic`, or `playfair`. +# Choose from `default`, `classic`, `rose`, or `mr_robot`. font = "default" # Description for social sharing and search engines. If undefined, superuser role is used in place. @@ -39,6 +39,10 @@ math = false # Anonymize IP in Google Analytics (if enabled) privacy_pack = false +# Enable visitors to edit pages? +# `repo` defines the repository URL. `editable` defines which page types can be edited. +edit_page = {repo_url = "https://github.com/gcushen/hugo-academic", editable = {docs = true}} + # Date and time format (refer to https://sourcethemes.com/academic/docs/customization/#date-format ) # Examples: "Mon, Jan 2, 2006" or "2006-01-02" date_format = "Jan 2, 2006" @@ -86,7 +90,7 @@ contact_links = [ # 1: Google Maps # 2: OpenStreetMap (Mapnik) # 3: OpenStreetMap (Mapbox) -map = 0 +map = 2 map_api_key = "" latitude = "37.4275" longitude = "-122.1697" diff --git a/i18n/en.yaml b/i18n/en.yaml index 5799225b..653ef7df 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -29,6 +29,9 @@ - id: figure translation: "Figure %d:" +- id: edit_page + translation: Edit this page + # Buttons - id: btn_preprint diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c8d06775..107ee5d7 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -3,7 +3,7 @@ {{ partial "site_head.html" . }} - + {{ partial "search" . }} diff --git a/layouts/partials/docs_layout.html b/layouts/partials/docs_layout.html index c8e04ea9..924fb8b2 100644 --- a/layouts/partials/docs_layout.html +++ b/layouts/partials/docs_layout.html @@ -39,7 +39,15 @@