Skip to content

Commit

Permalink
Update hugo from 0.82.0 to 0.132.1
Browse files Browse the repository at this point in the history
Make site compatible with broken changes
  • Loading branch information
robyngit committed Aug 13, 2024
1 parent f259054 commit 26d0273
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .forestry/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ file_template: ":filename:"
build:
preview_env:
- HUGO_ENV=staging
- HUGO_VERSION=0.82.0
- HUGO_VERSION=0.132.1
preview_output_directory: public
preview_docker_image: forestryio/hugo:latest
mount_path: "/srv"
working_dir: "/srv"
instant_preview_command: hugo server --renderToDisk -d public
version: 0.82.0
version: 0.132.1
2 changes: 1 addition & 1 deletion .github/workflows/deploy-hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.82.0"
hugo-version: "0.132.1"
extended: true
- name: Build Site
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/metacatui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.82.0"
hugo-version: "0.132.1"
extended: true
- name: Build Site
run: |
Expand Down
2 changes: 1 addition & 1 deletion themes/dataone/assets/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* @return {boolean} true if mobile, false if desktop
*/
block.isMobile = function(){
var mobileDesktopBreakpoint = {{- .Site.Params.mobileDesktopBreakpoint -}} || 700;
var mobileDesktopBreakpoint = {{- .Params.mobileDesktopBreakpoint -}} || 700;
var winWidth = window.innerWidth || document.documentElement.clientWidth;
if(winWidth < mobileDesktopBreakpoint){
return true
Expand Down
8 changes: 4 additions & 4 deletions themes/dataone/assets/scss/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// execute all SCSS files as template, so that scss files can contain hugo
// templating code if needed. * SITE IS PASSED AS THE CONTEXT *

{{ $site := .Site }}
{{ $page := . }}

// ==== IMPORT ALL ASSET SCSS ====
// Use a slice of file names instead of ranging through the directory because
Expand All @@ -14,7 +14,7 @@
{{ $ext := ".scss" }}
{{ range $name := $scssFiles }}
{{ $assetPath := path.Join $scssAssetDir (print $name $ext) }}
{{ $asset := resources.Get $assetPath | resources.ExecuteAsTemplate (print $name ".scss") $.Site }}
{{ $asset := resources.Get $assetPath | resources.ExecuteAsTemplate (print $name ".scss") $page.Site }}
{{ $asset.Content | safeCSS }}
{{ end }}

Expand All @@ -25,7 +25,7 @@
// If the file is an .scss file, import it
{{ if or (strings.HasSuffix .Name "scss") (strings.HasSuffix .Name "css") }}
{{ $blockscss := path.Join $librariesdir .Name }}
{{ $cssResource := readFile $blockscss | resources.FromString (print .Name ".scss") | resources.ExecuteAsTemplate (print .Name "2.scss") $site }}
{{ $cssResource := readFile $blockscss | resources.FromString (print .Name ".scss") | resources.ExecuteAsTemplate (print .Name "2.scss") $page.Site }}
{{ $cssResource.Content | safeCSS }}
{{ end }}
{{ end }}
Expand All @@ -44,7 +44,7 @@
// If the file is an .scss file, import it
{{ if (strings.HasSuffix .Name "scss") }}
{{ $blockscss := path.Join $blocksubdir .Name }}
{{ $cssResource := readFile $blockscss | resources.FromString (print .Name ".scss") | resources.ExecuteAsTemplate (print .Name "2.scss") $site }}
{{ $cssResource := readFile $blockscss | resources.FromString (print .Name ".scss") | resources.ExecuteAsTemplate (print .Name "2.scss") $page.Site }}
{{ $cssResource.Content | safeCSS }}
{{ end }}
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion themes/dataone/assets/scss/fonts.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The font directory relative to the location of the compiled CSS file
{{- $site := .Site -}}
{{- $site := . -}}

{{- $fontsDir := $site.Params.fontsDirRelCss | default "../fonts/" -}}

Expand Down
2 changes: 1 addition & 1 deletion themes/dataone/assets/scss/root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
//
// Product theme colors
// ==========================================================================
{{ $services := where $.Site.Pages "Type" "services" }}
{{ $services := where .Pages "Type" "services" }}
{{ $services := where $services "Params.service_color" "!=" nil }}
{{ range $service := $services }}
{{ $color := $service.Params.service_color }};
Expand Down
2 changes: 1 addition & 1 deletion themes/dataone/assets/scss/variables.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==== GLOBAL SPACING VARIABLES ====
// Screen width at which to switch from mobile view to desktop view
$breakpoint : {{ .Site.Params.mobileDesktopBreakpoint }}px;
$breakpoint : {{ .Params.mobileDesktopBreakpoint }}px;
// Overwrite the responsive font size default (used by responsive-font-size.scss)
$rfs-breakpoint: $breakpoint;
$default-border-radius : .25rem;
Expand Down
2 changes: 1 addition & 1 deletion themes/dataone/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!-- Get the bundled javascript resources -->
{{- $js := resources.Get "js/main.js" | resources.ExecuteAsTemplate "main.js" . -}}
{{/* TODO: minifying the JS results in empty JS since update from 0.74.3 to 0.82.0. Do not minify for now. */}}
{{/* {{- if not $page.Site.IsServer -}} */}}
{{/* {{- if not hugo.IsServer -}} */}}
{{/* {{- $js = $js | resources.Minify -}} */}}
{{/* {{- end -}} */}}
{{- $version := now.Format "2006-01-02_15.04.05_-0700" -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var homepageHeader = document.getElementById("homepage_header");
if (homepageHeader) {

{{- $homepage := .Site.GetPage "/_index.md" -}}
{{- $homepage := .GetPage "/_index.md" -}}
{{- $headerImages := $homepage.Params.header.images -}}
{{- $headerImagePaths := slice -}}
{{- range $headerImages -}}
Expand Down
2 changes: 1 addition & 1 deletion themes/dataone/layouts/partials/blocks/toc/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
classActive = "active",

// The screen size at which to define "desktop" vs "mobile"
mobileDesktopBreakpoint = {{- .Site.Params.mobileDesktopBreakpoint -}} || 700;
mobileDesktopBreakpoint = {{- $site.Params.mobileDesktopBreakpoint -}} || 700;

/**
* initialize - Functions to run once the HTML elements are loaded.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Rounds a number and displays as thousands (e.g. 999.9 K) or millions (e.g. 999.9 M) -->
{{- $return := 0 -}}
{{- with . -}}
{{- $millions := div . 1000000.0 | lang.NumFmt 1 -}}
{{- $thousands := div . 1000.0 | lang.NumFmt 1 -}}
{{- $millions := div . 1000000.0 | lang.FormatNumberCustom 1 -}}
{{- $thousands := div . 1000.0 | lang.FormatNumberCustom 1 -}}

{{- if ge $millions 1 -}}
{{- $return = print $millions " M" -}}
Expand Down
8 changes: 5 additions & 3 deletions themes/dataone/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<head>


{{- $page := . -}}
{{- $pageTitle := .Title -}}
{{- if not $pageTitle -}}
Expand All @@ -8,7 +9,7 @@
{{- if not $pageTitle -}}
{{ $pageTitle = .Params.fullname -}}
{{- end -}}

<!-- For IE <= 9 -->
<!--[if IE]>
<script type="text/javascript">
Expand Down Expand Up @@ -71,8 +72,9 @@
{{- end -}}

{{- $options := (dict "enableSourceMap" true "includePaths" (slice .Site.Params.blockDir)) -}}
{{- $style := resources.Get "scss/_main.scss" | resources.ExecuteAsTemplate "styles.css" $.Site | toCSS $options -}}
{{- if not $page.Site.IsServer -}}

{{- $style := resources.Get "scss/_main.scss" | resources.ExecuteAsTemplate "styles.css" $page | toCSS $options -}}
{{- if not hugo.IsServer -}}
{{- $style = $style | minify -}}
{{- end -}}
<!-- Make a 'version' string -->
Expand Down

0 comments on commit 26d0273

Please sign in to comment.