mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 12:13:58 +00:00
refactor: check admin created a homepage or give error
This commit is contained in:
1 parent
aa8b3f35ba
commit
6778929449
3 files changed
+13
-3
No files matched your search
+6
-1
@@ -1,6 +1,7 @@
|
||||
+++
|
||||
# A section created with the Blank widget.
|
||||
widget = "blank" # Do not modify this line!
|
||||
widget = "blank" # See https://sourcethemes.com/academic/docs/page-builder/
|
||||
headless = true # This file represents a page section.
|
||||
active = true # Activate this widget? true/false
|
||||
weight = 1 # Order that this section will appear.
|
||||
|
||||
@@ -32,6 +33,10 @@ subtitle = ""
|
||||
# Text color (true=light or false=dark).
|
||||
# text_color_light = true
|
||||
|
||||
[design.spacing]
|
||||
# Customize the section spacing. Order is top, right, bottom, left.
|
||||
# padding = ["0px", "0px", "0px", "0px"]
|
||||
|
||||
[advanced]
|
||||
# Custom CSS.
|
||||
css_style = ""
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# Configure the English version of the site.
|
||||
[en]
|
||||
languageCode = "en-us"
|
||||
# contentDir = "content/en" # Uncomment for multi-lingual sites, and move English content into `en` sub-folder.
|
||||
|
||||
# Uncomment the lines below to configure your website in a second language.
|
||||
#[zh]
|
||||
|
||||
@@ -4,16 +4,20 @@
|
||||
<!-- Flag for jQuery -->
|
||||
<span id="homepage" class="d-none"></span>
|
||||
|
||||
{{/* Get widget page path */}}
|
||||
{{/* Get widget page */}}
|
||||
{{ $page := "" }}
|
||||
{{ if .IsHome }}
|
||||
{{ $page = "/home" }}
|
||||
{{ 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 ." }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Load page sections */}}
|
||||
{{ $headless_bundle := .Site.GetPage $page }}
|
||||
{{ range $index, $st := where ( $headless_bundle.Resources.ByType "page" ) ".Params.active" "!=" false }}
|
||||
{{/* Begin widget styling */}}
|
||||
{{ $bg := $st.Params.design.background }}
|
||||
|
||||
Reference in new issue
Block a user