mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-27 03:25:16 +02:00
refactor: clarify error message when Hugo fails to load a Widget Page
See #1595 See #1599
This commit is contained in:
parent
ba7680ac2c
commit
8d25dbc61f
1 changed files with 15 additions and 6 deletions
|
@ -3,15 +3,24 @@
|
|||
|
||||
{{/* Get widget page */}}
|
||||
{{ $page := "" }}
|
||||
{{ $headless_bundle := "" }}
|
||||
{{ if .IsHome }}
|
||||
{{ $page = "/home" }}
|
||||
{{ $page = "/home/index.md" }}
|
||||
{{ $headless_bundle = site.GetPage $page }}
|
||||
{{/* Check homepage exists */}}
|
||||
{{ if not $headless_bundle }}
|
||||
{{ errorf "Homepage not found at %s!" $page }}
|
||||
{{ errorf "Add the `/home/index.md` homepage file to each language's content folder. For example, your site should have a `content/home/` folder containing `index.md` and your homepage sections, or for multi-language sites, `content/en/home/` and `content/zh/home/` etc. Refer to the 'Build Your Homepage' and 'Language' documentation at https://sourcethemes.com/academic/docs/ and the example homepage at https://github.com/gcushen/hugo-academic/tree/master/exampleSite/content/home/index.md ." }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $page = .File.Path }}
|
||||
{{ end }}
|
||||
{{ $headless_bundle := site.GetPage $page }}
|
||||
{{/* Check homepage exists */}}
|
||||
{{ if not $headless_bundle }}
|
||||
{{ errorf "Homepage not found or duplicate homepages detected for a localization! Add the `home/` folder (especially `/home/index.md`) to each language's content folder. For example, your site should have a `content/home/` folder containing `index.md` and your homepage sections, or for multi-language sites, `content/en/home/` and `content/zh/home/` etc. Refer to the 'Build Your Homepage' and 'Language' documentation at https://sourcethemes.com/academic/docs/ and the example homepage at https://github.com/gcushen/hugo-academic/tree/master/exampleSite/content/home/index.md ." }}
|
||||
{{ $headless_bundle = site.GetPage $page }}
|
||||
{{/* Check widget page exists. */}}
|
||||
{{ if not $headless_bundle }}
|
||||
{{ errorf "Widget Page not found at %s!" $page }}
|
||||
{{ errorf "View the Widget Page documentation at https://sourcethemes.com/academic/docs/managing-content/#create-a-widget-page . }}
|
||||
{{ errorf "If the Hugo version is between 0.65 and 0.68, it may be a confirmed Hugo bug that is expected to be fixed in Hugo v0.69: https://github.com/gcushen/hugo-academic/issues/1595#issuecomment-605514973 ." }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Load page sections */}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue