Allow rendering subdirectories as scrolling pages
This commit is contained in:
parent
94a56ac555
commit
d92da3689a
2 changed files with 10 additions and 8 deletions
121
layouts/_default/index.html
Normal file
121
layouts/_default/index.html
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
{{ define "main" }}
|
||||
{{ $headless := .GetPage "./homepage" }}
|
||||
{{ $sections := $headless.Resources.ByType "page" }}
|
||||
{{ $sections := cond .Site.BuildDrafts $sections (where $sections "Draft" "==" false) }}
|
||||
{{ $content := where (where $sections "Params.external" "==" nil) "Params.detailed_page_homepage_content" "ne" false }}
|
||||
{{ $translations := .Page.AllTranslations }}
|
||||
|
||||
<!-- Welcome screen that scrolls out of view -->
|
||||
{{ if not .Params.header_use_video }}
|
||||
{{ with $img := resources.Get .Params.header_image }}
|
||||
<style>
|
||||
#site-head.withCenteredImage {
|
||||
background-image: url('{{- $img.RelPermalink -}}'); /* Default for larger screens */
|
||||
}
|
||||
{{ range $size := slice 1280 1024 900 600 360 }}
|
||||
{{- with $img.Resize ( printf "%dx lanczos webp photo q100" $size ) -}}
|
||||
@media (max-width: {{- printf "%dpx" $size -}}) {
|
||||
#site-head.withCenteredImage { background-image: url('{{- .RelPermalink -}}'); }
|
||||
}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</style>
|
||||
{{ end }}
|
||||
<header id="site-head" class="withCenteredImage">
|
||||
{{ else }}
|
||||
<header id="site-head">
|
||||
{{ end }}
|
||||
|
||||
<div class="vertical">
|
||||
|
||||
{{ if .Params.header_use_video }}
|
||||
<!-- A partial to be overwritten by the user.
|
||||
Simply place a custom_header_video.html into
|
||||
your local /layouts/partials-directory -->
|
||||
{{- partial "custom_header_video.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ $num_lang := len $translations }}
|
||||
{{ if and (gt $num_lang 1) $.Site.Params.language_menu }}
|
||||
<div id="site-languages" class="inner">
|
||||
{{ range $translations }}
|
||||
{{ $lang_title := or .Language.LanguageName (.Lang | strings.ToUpper) }}
|
||||
{{ if eq .Lang $.Lang }}
|
||||
{{ if $.Site.Params.show_current_lang }}
|
||||
<span class='btn-lang active'>{{ $lang_title }}</span>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<a class='btn-lang' href='{{ .RelPermalink }}'>{{ $lang_title }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div id="site-head-content" class="inner">
|
||||
{{ with resources.Get .Params.header_logo }}<img id="blog-logo" alt="" src="{{ .RelPermalink }}" />{{ end }}
|
||||
|
||||
{{ if .Site.Params.title_guard }}<div class="title-and-description-guard">{{ end }}
|
||||
{{ with .Params.header_headline }}<h1 class="blog-title">{{ . | safeHTML }}</h1>{{ end }}
|
||||
{{ with .Params.header_subheadline }}<h2 class="blog-description">{{ . | safeHTML }}</h2>{{ end }}
|
||||
{{ if .Site.Params.title_guard }}</div>{{ end }}
|
||||
|
||||
{{ range where $sections ".Params.header_menu" "eq" true }}
|
||||
{{ $button_title := .Title }}
|
||||
{{ with .Params.header_menu_title }}{{ $button_title = . }}{{ end }}
|
||||
|
||||
{{ if isset .Params "external" }}
|
||||
<a class='btn site-menu' href='{{ .Params.external | absURL }}'>{{ $button_title }} <i class="fa fa-external-link"></i></a>
|
||||
{{ else if isset .Params "detailed_page_path" }}
|
||||
<a class='btn site-menu' href='{{ .Params.detailed_page_path | relURL }}'>{{ $button_title }}</a>
|
||||
{{ else }}
|
||||
{{ $fnav_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $fnav_title = . }}{{ end }}
|
||||
<a class='btn site-menu' data-title-anchor='{{ anchorize $fnav_title }}' href='#{{ anchorize $fnav_title }}'>{{ $button_title }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with (index $content 0) }}
|
||||
{{ $first_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $first_title = . }}{{ end }}
|
||||
<a id='header-arrow' href="#{{- anchorize $first_title -}}" aria-label="Go to first section"><i class="fa fa-angle-down"></i></a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="content" role="main">
|
||||
<!-- Render sticky left navigation menu -->
|
||||
<div class='fixed-nav'>
|
||||
{{ if eq .Params.nav_to_top_weight "first" }}
|
||||
{{ $fnav_title := "Start" }}{{ with .Params.nav_to_top_title }}{{ $fnav_title = . }}{{ end }}
|
||||
<a class='fn-item' item_index='{{ 0 }}' href='./#site-head'>{{ $fnav_title | safeHTML }}</a>
|
||||
{{ end }}
|
||||
{{ $last_index_val := 0 }}
|
||||
{{ range $index_val, $elem_val := $content }}
|
||||
{{ $fnav_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $fnav_title = . }}{{ end }}
|
||||
<a class='fn-item' item_index='{{ (add $index_val 1) }}' href='#{{ anchorize $fnav_title }}'>{{ $fnav_title | safeHTML }}</a>
|
||||
{{ $last_index_val = $index_val }}
|
||||
{{ end }}
|
||||
{{ if eq .Params.nav_to_top_weight "last" }}
|
||||
{{ $fnav_title := "Start" }}{{ with .Params.nav_to_top_title }}{{ $fnav_title = . }}{{ end }}
|
||||
<a class='fn-item' item_index='{{ (add $last_index_val 2) }}' href='./#site-head'>{{ $fnav_title | safeHTML }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<!-- Render single-page content -->
|
||||
{{ range $index_val, $elem_val := $content }}
|
||||
{{ if .Title }}
|
||||
{{ $fnav_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $fnav_title = . }}{{ end }}
|
||||
<div class='post-holder{{ if and (ne .Site.Params.invertSectionColors true) (not (modBool $index_val 2)) }} dark{{ else if and (eq .Site.Params.invertSectionColors true) (modBool $index_val 2) }} dark{{ end }}'>
|
||||
<article id='{{ anchorize $fnav_title }}' class='post {{ if eq $index_val 0 }}first{{ end }} {{ if eq (add $index_val 1) (len $content) }}last{{ end }}'>
|
||||
<header class="post-header">
|
||||
<h2 class="post-title">{{ .Title | emojify | safeHTML }}</h2>
|
||||
</header>
|
||||
<section class="post-content">
|
||||
{{ .Content }}
|
||||
</section>
|
||||
</article>
|
||||
<div class='post-after{{ if and (ne .Site.Params.invertSectionColors true) (modBool $index_val 2) }} light{{ else if and (eq .Site.Params.invertSectionColors true) (not (modBool $index_val 2)) }} light{{ end }}'></div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
<main class="content page-template page-{{ .Slug }}">
|
||||
<article class="post page">
|
||||
<header class="post-header">
|
||||
<a id="back-to-main-page" href="{{ "" | relLangURL }}"><i class="fa fa-chevron-left" aria-hidden="true"></i> {{ .Site.Title }}</a>
|
||||
{{ with .Parent }}
|
||||
<a id="back-to-main-page" href="{{ .RelPermalink | relLangURL }}"><i class="fa fa-chevron-left" aria-hidden="true"></i> {{ or .Title .Site.Title }}</a>
|
||||
{{ end }}
|
||||
</header>
|
||||
<h1 class="post-title">{{ .Title }}</h1>
|
||||
<section class="post-content">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue