Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flexibility to index.html to be used in subdirectories #196

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions layouts/index.html → layouts/_default/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{ define "main" }}
{{ $headless := .Site.GetPage "/homepage" }}
{{ $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 }}
{{ $languages := .Site.Languages }}
{{ $translations := .Page.AllTranslations }}

<!-- Welcome screen that scrolls out of view -->
{{ if not .Params.header_use_video }}
Expand Down Expand Up @@ -35,17 +35,17 @@
{{- partial "custom_header_video.html" . -}}
{{ end }}

{{ $num_lang := len $languages }}
{{ $num_lang := len $translations }}
{{ if and (gt $num_lang 1) $.Site.Params.language_menu }}
<div id="site-languages" class="inner">
{{ range site.Sites }}
{{ $lang_title := or .Language.LanguageName (.Language.Lang | strings.ToUpper) }}
{{ if eq . $.Site }}
{{ 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='{{ .Home.Permalink }}'>{{ $lang_title }}</a>
<a class='btn-lang' href='{{ .RelPermalink }}'>{{ $lang_title }}</a>
{{ end }}
{{ end }}
</div>
Expand Down
4 changes: 3 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down