From 585bdf643b695f48aae9ce8055e4895a28029e1a Mon Sep 17 00:00:00 2001 From: George Cushen Date: Wed, 17 Apr 2019 19:26:51 +0100 Subject: [PATCH] fix: add support for Hugo v0.55 Requires Hugo v0.55.2+. Does not work with Hugo v0.55.0 due to bugs fixed in v0.55.2. Fix #1017 --- README.md | 10 +- exampleSite/config/_default/config.toml | 1 - .../content/post/getting-started/index.md | 116 ++++++------------ exampleSite/content/talk/example/index.md | 2 +- layouts/author/list.html | 4 +- layouts/author/terms.html | 2 +- layouts/index.css | 2 +- layouts/index.html | 2 +- layouts/index.json | 8 +- layouts/partials/docs_layout.html | 2 +- layouts/partials/docs_sidebar.html | 4 +- layouts/partials/footer.html | 10 +- layouts/partials/header.html | 11 +- layouts/partials/li_card.html | 6 +- layouts/partials/li_citation.html | 2 +- layouts/partials/li_compact.html | 6 +- layouts/partials/li_list.html | 6 +- layouts/partials/page_author.html | 4 +- layouts/partials/page_links.html | 58 ++++----- layouts/partials/page_links_div.html | 11 +- layouts/partials/page_metadata.html | 12 +- layouts/partials/page_metadata_authors.html | 4 +- layouts/partials/pagination.html | 4 +- layouts/partials/search.html | 2 +- layouts/partials/tags.html | 2 +- layouts/partials/widgets/about.html | 6 +- layouts/partials/widgets/contact.html | 32 ++--- layouts/partials/widgets/featured.html | 8 +- layouts/partials/widgets/pages.html | 10 +- layouts/partials/widgets/people.html | 8 +- layouts/partials/widgets/portfolio.html | 2 +- layouts/partials/widgets/tag_cloud.html | 16 +-- layouts/publication/single.html | 2 +- layouts/rss.xml | 23 ++-- layouts/shortcodes/alert.html | 2 +- layouts/shortcodes/hl.html | 2 +- layouts/shortcodes/list_categories.html | 2 +- layouts/shortcodes/list_tags.html | 2 +- layouts/shortcodes/speaker_note.html | 2 +- layouts/sitemap.xml | 14 --- layouts/talk/single.html | 6 +- netlify.toml | 2 +- theme.toml | 43 +++++-- 43 files changed, 218 insertions(+), 255 deletions(-) delete mode 100644 layouts/sitemap.xml diff --git a/README.md b/README.md index 0a26cf68..a9145087 100644 --- a/README.md +++ b/README.md @@ -74,22 +74,20 @@ You can choose from one of the following four methods to install: * One-click install of Academic creates an `academic-kickstart` repository in your GitHub or GitLab account * Netlify will provide you with a customizable URL to access your new site, [or get your own domain](https://sourcethemes.com/academic/docs/domain/) * Shortly after editing content in your repository, your site will automatically update - * Optionally, use [Git](https://git-scm.com/downloads) to clone your new repository to your computer for offline editing + * Optionally, to edit your site in a [Markdown editor](https://www.typora.io) on your computer, perform the steps in the [*Install with Git*](#install-with-git) section below ### Install with Git Prerequisites: * [Download and install Git](https://git-scm.com/downloads) -* [Download and install Hugo v0.53](https://gohugo.io/getting-started/installing/#quick-install) +* [Download and install Hugo v0.55.2+](https://gohugo.io/getting-started/installing/#quick-install) Install: -1. [Fork](https://github.com/sourcethemes/academic-kickstart#fork-destination-box) the *Academic Kickstart* repository and clone your fork with Git: +1. [Fork](https://github.com/sourcethemes/academic-kickstart#fork-destination-box) the *Academic Kickstart* repository and clone your fork with Git, replacing `sourcethemes` with your GitHub username (unless you wish to clone without forking): git clone https://github.com/sourcethemes/academic-kickstart.git My_Website - - *Note that if you forked Academic Kickstart, the above command should be edited to clone your fork, i.e. replace `sourcethemes` with your GitHub username.* 2. Initialize the theme: @@ -100,7 +98,7 @@ Install: Prerequisites: -* [Download and install Hugo v0.53](https://gohugo.io/getting-started/installing/#quick-install) +* [Download and install Hugo v0.55.2+](https://gohugo.io/getting-started/installing/#quick-install) Install: diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml index 8bc4a359..dc9027a3 100644 --- a/exampleSite/config/_default/config.toml +++ b/exampleSite/config/_default/config.toml @@ -40,7 +40,6 @@ paginate = 10 # Number of items per page in paginated lists. enableEmoji = true footnotereturnlinkcontents = "^" ignoreFiles = ["\\.ipynb$", ".ipynb_checkpoints$", "\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"] -preserveTaxonomyNames = true [outputs] home = [ "HTML", "CSS", "RSS", "JSON" ] diff --git a/exampleSite/content/post/getting-started/index.md b/exampleSite/content/post/getting-started/index.md index 378201bf..f0b3101f 100644 --- a/exampleSite/content/post/getting-started/index.md +++ b/exampleSite/content/post/getting-started/index.md @@ -1,16 +1,16 @@ +++ -title = "Academic: the website designer for Hugo" +title = "Academic: the website builder for Hugo" subtitle = "Create a beautifully simple website in under 10 minutes :rocket:" -date = 2016-04-20T00:00:00 -lastmod = 2018-01-13T00:00:00 -draft = false +date = 2016-04-20T00:00:00 # Schedule a publish date +lastmod = 2019-04-17T00:00:00 # Date last modified +draft = false # Display this post? (true/false) # Authors. Comma separated list, e.g. `["Bob Smith", "David Jones"]`. authors = ["admin"] tags = ["Academic"] -summary = "Create a beautifully simple website or blog in under 10 minutes." +summary = "Create a beautifully simple website in under 10 minutes." # Projects (optional). # Associate this post with one or more of your projects. @@ -76,10 +76,12 @@ image = "theme-cupcake.png" caption = "Cupcake" +++ -**Academic** makes it easy to create a beautiful website for free using Markdown. Customize anything on your site with widgets, themes, and language packs. +**Create a free website with Academic using Markdown, Jupyter, or RStudio. Choose a beautiful color theme and build anything with the Page Builder - over 40 _widgets_, _themes_, and _language packs_ included!** -Follow our easy [step by step guide](https://sourcethemes.com/academic/docs/install/) to learn how to build your own free website with Academic. [Check out the personal demo](https://academic-demo.netlify.com/) or the [business demo](https://sourcethemes.com/academic/) of what you'll get in less than 10 minutes. +[Check out the latest **demo**](https://academic-demo.netlify.com/) of what you'll get in less than 10 minutes, or [view the **showcase**](https://sourcethemes.com/academic/#expo) of personal, project, and business sites. +- [**Setup Academic**](#install) +- [**Get Started**](https://sourcethemes.com/academic/docs/get-started/) - [View the documentation](https://sourcethemes.com/academic/docs/) - [Ask a question](http://discuss.gohugo.io/) - [Request a feature or report a bug](https://github.com/gcushen/hugo-academic/issues) @@ -92,19 +94,29 @@ Follow our easy [step by step guide](https://sourcethemes.com/academic/docs/inst [![Screenshot](https://raw.githubusercontent.com/gcushen/hugo-academic/master/academic.png)](https://github.com/gcushen/hugo-academic/) -Key features: +**Key features:** -- Easily manage various content including homepage, blog posts, publications, talks, and projects -- Extensible via **color themes** and **widgets/plugins** -- Write in [Markdown](https://sourcethemes.com/academic/docs/writing-markdown-latex/) for easy formatting and code highlighting, with [LaTeX](https://en.wikibooks.org/wiki/LaTeX/Mathematics) for mathematical expressions -- Social/academic network linking, [Google Analytics](https://analytics.google.com), and [Disqus](https://disqus.com) comments -- Responsive and mobile friendly -- Simple and refreshing one page design -- Multilingual and easy to customize +- **Page builder** - Create *anything* with [**widgets**](https://sourcethemes.com/academic/docs/page-builder/) and [**elements**](https://sourcethemes.com/academic/docs/writing-markdown-latex/) +- **Edit any type of content** - Blog posts, publications, talks, slides, projects, and more! +- **Create content** in [**Markdown**](https://sourcethemes.com/academic/docs/writing-markdown-latex/), [**Jupyter**](https://sourcethemes.com/academic/docs/jupyter/), or [**RStudio**](https://sourcethemes.com/academic/docs/install/#install-with-rstudio) +- **Plugin System** - Fully customizable [**color** and **font themes**](https://sourcethemes.com/academic/themes/) +- **Display Code and Math** - Code highlighting and [LaTeX math](https://en.wikibooks.org/wiki/LaTeX/Mathematics) supported +- **Integrations** - [Google Analytics](https://analytics.google.com), [Disqus commenting](https://disqus.com), Maps, Contact Forms, and more! +- **Beautiful Site** - Simple and refreshing one page design +- **Industry-Leading SEO** - Help get your website found on search engines and social media +- **Media Galleries** - Display your images and videos with captions in a customizable gallery +- **Mobile Friendly** - Look amazing on every screen with a mobile friendly version of your site +- **Multi-language** - 15+ language packs including English, 中文, and Português +- **Multi-user** - Each author gets their own profile page +- **Privacy Pack** - Assists with GDPR +- **Stand Out** - Bring your site to life with animation, parallax backgrounds, and scroll effects +- **One-Click Deployment** - No servers. No databases. Only files. ## Color Themes -Academic is available in different color themes and font themes. +Academic comes with **day (light) and night (dark) mode** built-in. Click the sun/moon icon in the top right of the [Demo](https://academic-demo.netlify.com/) to see it in action! + +Choose a stunning color and font theme for your site. Themes are fully customizable and include: {{< gallery >}} @@ -117,76 +129,18 @@ Academic is available in different color themes and font themes. You can choose from one of the following four methods to install: -* one-click install using your web browser (recommended) -* install on your computer using Git with the Command Prompt/Terminal app -* install on your computer by downloading the ZIP files -* install on your computer with RStudio +* [**one-click install using your web browser (recommended)**](https://sourcethemes.com/academic/docs/install/#install-with-web-browser) +* [install on your computer using **Git** with the Command Prompt/Terminal app](https://sourcethemes.com/academic/docs/install/#install-with-git) +* [install on your computer by downloading the **ZIP files**](https://sourcethemes.com/academic/docs/install/#install-with-zip) +* [install on your computer with **RStudio**](https://sourcethemes.com/academic/docs/install/#install-with-rstudio) -### Quick install using your web browser - -1. [Install Academic with Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/sourcethemes/academic-kickstart) - * Netlify will provide you with a customizable URL to access your new site -2. On GitHub, go to your newly created `academic-kickstart` repository and edit `config.toml` to personalize your site. Shortly after saving the file, your site will automatically update -3. Read the [Quick Start Guide](https://sourcethemes.com/academic/docs/) to learn how to add Markdown content. For inspiration, refer to the [Markdown content](https://github.com/gcushen/hugo-academic/tree/master/exampleSite) which powers the [Demo](https://academic-demo.netlify.com/) - -### Install with Git - -Prerequisites: - -* [Download and install Git](https://git-scm.com/downloads) -* [Download and install Hugo](https://gohugo.io/getting-started/installing/#quick-install) - -1. [Fork](https://github.com/sourcethemes/academic-kickstart#fork-destination-box) the *Academic Kickstart* repository and clone your fork with Git: - - git clone https://github.com/sourcethemes/academic-kickstart.git My_Website - - *Note that if you forked Academic Kickstart, the above command should be edited to clone your fork, i.e. replace `sourcethemes` with your GitHub username.* - -2. Initialize the theme: - - cd My_Website - git submodule update --init --recursive - -### Install with ZIP - -1. [Download](https://github.com/sourcethemes/academic-kickstart/archive/master.zip) and extract *Academic Kickstart* -2. [Download](https://github.com/gcushen/hugo-academic/archive/master.zip) and extract the *Academic theme* to the `themes/academic/` folder from the above step - -### Install with RStudio - -[View the guide to installing Academic with RStudio](https://sourcethemes.com/academic/docs/install/#install-with-rstudio) - -## Quick start - -1. If you installed on your computer, view your new website by running the following command: - - hugo server - - Now visit [localhost:1313](http://localhost:1313) and your new Academic powered website will appear. Otherwise, if using Netlify, they will provide you with your URL. - -2. Read the [Quick Start Guide](https://sourcethemes.com/academic/docs/) to learn how to add Markdown content, customize your site, and deploy it. For inspiration, refer to the [Markdown content](https://github.com/gcushen/hugo-academic/tree/master/exampleSite) which powers the [Demo](https://academic-demo.netlify.com/) - -3. Build your site by running the `hugo` command. Then [host it for free using Github Pages](https://georgecushen.com/create-your-website-with-hugo/) or Netlify (refer to the first installation method). Alternatively, copy the generated `public/` directory (by FTP, Rsync, etc.) to your production web server (such as a university's hosting service). +Then [personalize and deploy your new site](https://sourcethemes.com/academic/docs/get-started/). ## Updating -Feel free to *star* the project on [Github](https://github.com/gcushen/hugo-academic/) to help keep track of updates and check out the [release notes](https://sourcethemes.com/academic/updates) prior to updating your site. +[View the Update Guide](https://sourcethemes.com/academic/docs/update/). -Before updating the framework, it is recommended to make a backup of your entire website directory (or at least your `themes/academic` directory) and record your current version number. - -By default, Academic is installed as a Git submodule which can be updated by running the following command: - -```bash -git submodule update --remote --merge -``` - -[Check out the update guide](https://sourcethemes.com/academic/docs/update/) for full instructions and alternative methods. - -## Feedback & Contributing - -Please use the [issue tracker](https://github.com/gcushen/hugo-academic/issues) to let me know about any bugs or feature requests, or alternatively make a pull request. - -For support, head over to the [Hugo discussion forum](http://discuss.gohugo.io). +Feel free to *star* the project on [Github](https://github.com/gcushen/hugo-academic/) to help keep track of [updates](https://sourcethemes.com/academic/updates). ## License diff --git a/exampleSite/content/talk/example/index.md b/exampleSite/content/talk/example/index.md index 37e2149b..b644c42a 100644 --- a/exampleSite/content/talk/example/index.md +++ b/exampleSite/content/talk/example/index.md @@ -77,7 +77,7 @@ Click on the **Slides** button above to view the built-in slides feature. Slides can be added in a few ways: -- **Create** slides using Academic's *Slides* feature and link using `url_slides` parameter in the front matter of the talk file +- **Create** slides using Academic's [*Slides*](https://sourcethemes.com/academic/docs/managing-content/#create-slides) feature and link using `slides` parameter in the front matter of the talk file - **Upload** an existing slide deck to `static/` and link using `url_slides` parameter in the front matter of the talk file - **Embed** your slides (e.g. Google Slides) or presentation video on this page using [shortcodes](https://sourcethemes.com/academic/docs/writing-markdown-latex/). diff --git a/layouts/author/list.html b/layouts/author/list.html index fe512e22..6c2ad112 100644 --- a/layouts/author/list.html +++ b/layouts/author/list.html @@ -2,7 +2,7 @@ {{ partial "navbar.html" . }} {{/* Just display author name as title if user profile unavailable. */}} -{{ if not ($.Site.GetPage (printf "/author/%s" (urlize .Title))) }} +{{ if not (site.GetPage (printf "/author/%s" (urlize .Title))) }}

{{ .Title }}

@@ -13,7 +13,7 @@ {{/* Only show About widget if a profile has been configured for this user. */}} {{ $widget := "widgets/about.html" }} {{ $params := dict "root" $ "page" . "author" .Title }} - {{ with $.Site.GetPage (printf "/author/%s" (urlize .Title)) }} + {{ with site.GetPage (printf "/author/%s" (urlize .Title)) }} {{ partial $widget $params }} {{ end }} diff --git a/layouts/author/terms.html b/layouts/author/terms.html index 854a66fa..6d9add9d 100644 --- a/layouts/author/terms.html +++ b/layouts/author/terms.html @@ -12,7 +12,7 @@ {{ $paginator := .Paginate .Data.Pages }} {{ range $k, $v := $paginator.Pages }} {{ $person_page_path := (printf "/author/%s" (urlize $v.Title)) }} - {{ $person_page := $.Site.GetPage $person_page_path }} + {{ $person_page := site.GetPage $person_page_path }} {{ $name := "" }} {{ if $person_page }} {{ $person := $person_page.Params }} diff --git a/layouts/index.css b/layouts/index.css index d1ae6b73..8c27537f 100644 --- a/layouts/index.css +++ b/layouts/index.css @@ -1,5 +1,5 @@ {{- $scr := .Scratch -}} -{{- $scr.Set "site" $.Site -}} +{{- $scr.Set "site" site -}} {{- partial "css/parse_theme.css" . -}} diff --git a/layouts/index.html b/layouts/index.html index 93bdb427..61d90826 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,4 +1,4 @@ -{{ if not (isset $.Site.Params "color_theme") }} +{{ if not (isset site.Params "color_theme") }} {{ errorf "Please complete the installation of Academic by following the steps at https://sourcethemes.com/academic/docs/install/" }} {{ end }} {{ partial "widget_page.html" . }} diff --git a/layouts/index.json b/layouts/index.json index 29ff22bc..7dde82e0 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -4,7 +4,7 @@ {{- /* Add the index page of docs separately since it's not in RegularPages above. */ -}} {{- $pages := $pages | union (where (where .Site.Pages "Kind" "section") "Type" "docs") -}} {{- /* Add author pages to index so their bios can be searched. Hide empty `/author/` node. */ -}} -{{- $pages := $pages | union (where (where $.Site.Pages "Section" "author") "Params.name" "!=" nil) -}} +{{- $pages := $pages | union (where (where site.Pages "Section" "author") "Params.name" "!=" nil) -}} {{- range $pages -}} {{- /* Do not index drafts or private pages. */ -}} @@ -29,7 +29,7 @@ {{- if eq .Section "author" -}} {{- $title = .Params.name -}} {{- $dir := path.Base (path.Split .Path).Dir -}} - {{- with $.Site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) -}} + {{- with site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) -}} {{- $permalink = .Permalink -}} {{- $rel_permalink = .RelPermalink -}} {{- end -}} @@ -41,7 +41,7 @@ {{- $authors = slice -}} {{- range $k, $v := .Params.authors -}} {{- $person_page_path := (printf "/author/%s" (urlize $v)) -}} - {{- $person_page := $.Site.GetPage $person_page_path -}} + {{- $person_page := site.GetPage $person_page_path -}} {{- if $person_page -}} {{- $person := $person_page.Params -}} {{- $authors = $authors | append $person.name -}} @@ -54,7 +54,7 @@ {{- end -}} {{- /* Add page to index. */ -}} - {{- $index = $index | append (dict "objectID" .UniqueID "date" .Date.UTC.Unix "publishdate" .PublishDate "lastmod" .Lastmod.UTC.Unix "expirydate" .ExpiryDate.UTC.Unix "lang" .Lang "permalink" $permalink "relpermalink" $rel_permalink "title" $title "summary" (plainify $desc) "content" .Plain "authors" $authors "kind" .Kind "type" .Type "section" .Section "tags" .Params.Tags "categories" .Params.Categories) -}} + {{- $index = $index | append (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "publishdate" .PublishDate "lastmod" .Lastmod.UTC.Unix "expirydate" .ExpiryDate.UTC.Unix "lang" .Lang "permalink" $permalink "relpermalink" $rel_permalink "title" $title "summary" (plainify $desc) "content" .Plain "authors" $authors "kind" .Kind "type" .Type "section" .Section "tags" .Params.Tags "categories" .Params.Categories) -}} {{- end -}} {{- end -}} diff --git a/layouts/partials/docs_layout.html b/layouts/partials/docs_layout.html index 96bd7bfb..94af9d7d 100644 --- a/layouts/partials/docs_layout.html +++ b/layouts/partials/docs_layout.html @@ -39,7 +39,7 @@ diff --git a/layouts/partials/docs_sidebar.html b/layouts/partials/docs_sidebar.html index 7bccb3dc..b293652f 100644 --- a/layouts/partials/docs_sidebar.html +++ b/layouts/partials/docs_sidebar.html @@ -10,14 +10,14 @@ - {{ if eq $.Site.Params.search.engine 1 }} + {{ if eq site.Params.search.engine 1 }} {{ end }}