Skip to content

Add Support for Hugo v0.55+ #1017

Closed
Closed
@gcushen

Description

@gcushen
Collaborator

Hugo v0.55 has breaking changes that break some features and also warns of future deprecation of several variables. See https://github.com/gohugoio/hugo/releases/tag/v0.55.0

Therefore, refactor the code and require Hugo v0.55+ going forward.

  • Refactor code based on Hugo v0.55 log messages:
WARN Page's .Hugo is deprecated and will be removed in a future release. Use the global hugo function.
WARN Page's .RSSLink is deprecated and will be removed in a future release. Use the Output Format's link, e.g. something like: 
    {{ with .OutputFormats.Get "RSS" }}{{ . RelPermalink }}{{ end }}.
WARN Page's .Dir is deprecated and will be removed in a future release. Use .File.Dir.
WARN Page's .UniqueID is deprecated and will be removed in a future release. Use .File.UniqueID.
WARN Page's .URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url.

Also, due to the breaking changes in Hugo v0.55, the following may need refactoring to work with Hugo v0.55+:

  • Links to local page resources are now broken (such as for local "PDF" and "bib")
  • Shortcodes no longer work properly > Behaviour has changed for Shortcodes using the {{% construct
    • "If you want the old behavior, you can put the following line in the start of your shortcode template: {{ $_hugo_config := { "version": 1 } }}"
  • links to authors without profiles no longer works?
    preserveTaxonomyNamesconfiguration option is removed. Use .Page.Title.
  • We no longer add XML headers to Output Formats that output XML (<?xml version="1.0" encoding="utf-8" standalone="yes" ?>). This header is moved to the templates. If you have custom RSS or sitemap templates you may want to add the XML declaration to these. Since they, by default, is handled by Go's HTML template package, you must do something like this to make sure it's preserved: {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
    • upgrade rss.xml, remove sitemap.xml to revert to Hugo's latest internal tpl
  • The taxonomy nodes now have a .Page accessor which makes it much simpler to get a proper .Title etc.
    • upgrade tag_cloud.html

Activity

added this to the v4.3 milestone on Apr 9, 2019
changed the title [-]Refactor for Hugo v0.55+[/-] [+]Add Support for Hugo v0.55+[/+] on Apr 9, 2019
modified the milestones: v4.3, v4.2.1 on Apr 9, 2019
pinned this issue on Apr 11, 2019
brainstorm

brainstorm commented on Apr 12, 2019

@brainstorm

Awesome work @gcushen, super appreciated, this issue saved me quite a few of headaches today wondering why a fresh new site from scratch was not working after installing the theme via blogdown:

> blogdown::install_theme('gcushen/hugo-academic')

Is there a way to know which Hugo version is actually supported on master? I'm getting this message when running hugo@0.49.2 (after reading the very helpful breaking changes page):

ERROR 2019/04/12 14:57:29 HUGO-ACADEMIC theme does not support Hugo version 0.49.2. Minimum version required is 0.53

But then when I downgrade to 0.53 via:

$ brew unlink hugo
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/b285e5d4827f86ec6ad72bec2b881e4ce6fe931d/Formula/hugo.rb
$ brew list hugo
/usr/local/Cellar/hugo/0.53/bin/hugo
/usr/local/Cellar/hugo/0.53/etc/bash_completion.d/hugo.sh
/usr/local/Cellar/hugo/0.53/share/man/ (25 files)
$ hugo version
Hugo Static Site Generator v0.53/extended darwin/amd64 BuildDate: unknown

I'm getting this instead:

ERROR 2019/04/12 15:08:54 render of "page" failed: "/Users/romanvg/dev/umccr/site/themes/hugo-academic/layouts/_default/single.html:22:34": execute of template failed: template: _default/single.html:6:5: executing "_default/single.html" at <partial "page_header...>: error calling partial: "/Users/romanvg/dev/umccr/site/themes/hugo-academic/layouts/partials/page_header.html:22:34": execute of template failed: template: partials/page_header.html:92:7: executing "partials/page_header.html" at <partial "page_metada...>: error calling partial: "/Users/romanvg/dev/umccr/site/themes/hugo-academic/layouts/partials/page_metadata.html:22:34": execute of template failed: template: partials/page_metadata.html:22:34: executing "partials/page_metadata.html" at <$.Site.Params.date_f...>: invalid value; expected string

Thanks again in advance!

/cc @ohofmann @MrsLaviniaG

gcushen

gcushen commented on Apr 14, 2019

@gcushen
CollaboratorAuthor

@brainstorm the official installation guide for installing Academic with RStudio can be found here: https://sourcethemes.com/academic/docs/install/#install-with-rstudio

brainstorm

brainstorm commented on Apr 14, 2019

@brainstorm

Yes, @gcushen, I did follow that guide closely, I'll give it a second/third look and get back to you.

brainstorm

brainstorm commented on Apr 15, 2019

@brainstorm

The official installation guide assumes installation from scratch... in this case, the missing directory config made all the difference, only noticed it when starting from scratch all over again :-S

Thanks!

added a commit that references this issue on Apr 15, 2019
unpinned this issue on Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @brainstorm@gcushen

        Issue actions

          Add Support for Hugo v0.55+ · Issue #1017 · HugoBlox/hugo-blox-builder