Skip to content

Commit

Permalink
Hugo-Lecture: remove support for multilingual
Browse files Browse the repository at this point in the history
IsMultiLingual is no longer supported as of Hugo v.130.0, and we do not use this
anymore - so it can go for good.
  • Loading branch information
cagix committed Jul 29, 2024
1 parent b7dd434 commit 47f2d17
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
{{ $topic := .Page.File.TranslationBaseName }}

{{ $schedule := .Site.Data.schedule }}
{{ if .Site.IsMultiLingual }}
{{ $data := index .Site.Data .Site.Language.Lang }}
{{ $schedule = $data.schedule }}
{{ end }}

{{ $due := "" }}
{{ range $schedule }}
Expand Down
4 changes: 0 additions & 4 deletions hugo/hugo-lecture/layouts/partials/assignments.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{{ $assignments := .Params.assignments }}
{{ $schedule := .Site.Data.schedule }}
{{ if .Site.IsMultiLingual }}
{{ $data := index .Site.Data .Site.Language.Lang }}
{{ $schedule = $data.schedule }}
{{ end }}

{{ if $assignments }}

Expand Down
17 changes: 0 additions & 17 deletions hugo/hugo-lecture/layouts/partials/attachments.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,6 @@
{{ $url = printf "%s/%s" . $url }}
{{ end }}
{{ $url = $url | path.Clean | absURL }}

{{ if $.Site.IsMultiLingual }}
{{/*
Hugo will include the current language code as subdir in the URL, but the
additional content (images, files, ...) will be placed in the default
language dir only. So the content will not be reachable using the correct
URL generated by Hugo, and we have to use the URL pointing to the default
language dir in all language variants.

Replace the current language code in the path with the language code for the
default language, e.g. replace "/ma/" w/ "/ba/" in "path/ma/images/wuppie.png"
(result: "path/ba/images/wuppie.png").
*/}}
{{ $default_lang := printf "/%s/" (index $.Site.Languages 0).Lang }}
{{ $current_lang := printf "%s/" $.Site.LanguagePrefix }}
{{ $url = replace $url $current_lang $default_lang }}
{{ end }}
{{ end }}
{{ $c = printf "%s <li><a href='%s' class='icon reading' target='_blank' rel='nofollow noopener noreferrer'>%s</a></li>" $c ($url | safeURL) $n }}
{{ end }}
Expand Down
6 changes: 0 additions & 6 deletions hugo/hugo-lecture/layouts/partials/favicon.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}

{{ $logo := "images/logo.png" }}
{{ if .Site.IsMultiLingual }}
{{ with (strings.TrimPrefix "/" .Site.LanguagePrefix) }}
{{ $logo = printf "images/logo.%s.png" . }}
{{ end }}
{{ end }}

<link href="{{ $logo | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="image/png">
6 changes: 0 additions & 6 deletions hugo/hugo-lecture/layouts/partials/logo.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{{ $logo := "images/logo.png" }}

{{ if .Site.IsMultiLingual }}
{{ with (strings.TrimPrefix "/" .Site.LanguagePrefix) }}
{{ $logo = printf "images/logo.%s.png" . }}
{{ end }}
{{ end }}

<a id="logo" href='{{- .Site.BaseURL -}}/index.html'>
<img style="max-width:35%" alt="icon" src='{{- $logo | relURL -}}'>
</a>
17 changes: 0 additions & 17 deletions hugo/hugo-lecture/layouts/shortcodes/img.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@
{{ $src = printf "%s/%s" . $src }}
{{ end }}
{{ $src = $src | path.Clean | absURL }}

{{ if $.Site.IsMultiLingual }}
{{/*
Hugo will include the current language code as subdir in the URL, but the
additional content (images, files, ...) will be placed in the default
language dir only. So the content will not be reachable using the correct
URL generated by Hugo, and we have to use the URL pointing to the default
language dir in all language variants.

Replace the current language code in the path with the language code for the
default language, e.g. replace "/ma/" w/ "/ba/" in "path/ma/images/wuppie.png"
(result: "path/ba/images/wuppie.png").
*/}}
{{ $default_lang := printf "/%s/" (index $.Site.Languages 0).Lang }}
{{ $current_lang := printf "%s/" $.Site.LanguagePrefix }}
{{ $src = replace $src $current_lang $default_lang }}
{{ end }}
{{ end }}

{{/*
Expand Down

0 comments on commit 47f2d17

Please sign in to comment.