Render ancors from titles

This commit is contained in:
Hanzei 2018-06-27 11:30:11 +02:00
parent ae90b40388
commit db98ff7573
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
4 changed files with 8 additions and 9 deletions

View file

@ -36,7 +36,7 @@
<!-- Tell them all about it! --> <!-- Tell them all about it! -->
{{ with .Site.GetPage "page" "about" }} {{ with .Site.GetPage "page" "about" }}
<div class="section" id="about"> <div class="section" id="{{ .Title | urlize }}">
<div class="container"> <div class="container">
<h2 class="title is-2 has-text-centered">{{ .Title }}</h2> <h2 class="title is-2 has-text-centered">{{ .Title }}</h2>
<div class="columns"><!-- Avatar and about.md side by side except mobile --> <div class="columns"><!-- Avatar and about.md side by side except mobile -->
@ -66,7 +66,7 @@
<!-- Let's chat, shall we? --> <!-- Let's chat, shall we? -->
{{ with .Site.GetPage "page" "contact" }} {{ with .Site.GetPage "page" "contact" }}
<div class="section" id="contact"> <div class="section" id="{{ .Title | urlize }}">
<div class="container has-text-centered"> <div class="container has-text-centered">
<h2 class="title is-2">{{ .Title }}</h2> <h2 class="title is-2">{{ .Title }}</h2>
<div class="markdown"> <div class="markdown">

View file

@ -1,5 +1,5 @@
{{ with .Site.GetPage "section" "blog" }} {{ with .Site.GetPage "section" "blog" }}
<div class="section" id="blog"> <div class="section" id="{{ .Title | urlize }}">
<!-- Begin Blog container --> <!-- Begin Blog container -->
<div class="container"> <div class="container">
{{ if .Site.Params.showLatest }} {{ if .Site.Params.showLatest }}

View file

@ -14,16 +14,15 @@
{{ if not $isHome }} {{ if not $isHome }}
<a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a> <a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a>
{{ end }} {{ end }}
{{ with .Site.GetPage "page" "about" }} {{ with .Site.GetPage "page" "about" }}
<a class="nav-item" href="{{ if $isHome }}#about{{ else }}{{ "/#about" | relLangURL }}{{ end }}">{{ .Title }}</a> <a class="nav-item" href="{{ if $isHome }}#{{ .Title | urlize }}{{ else }}{{ printf "/#%s" (.Title | urlize) | relLangURL }}{{ end }}">{{ .Title }}</a>
{{ end }} {{ end }}
{{ $pageIsInProjects := eq .Page.Section "projects"}} {{ $pageIsInProjects := eq .Page.Section "projects"}}
{{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }} {{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "section" "projects" }} {{ with .Site.GetPage "section" "projects" }}
{{ if $isHome }} {{ if $isHome }}
<a class="nav-item" href="#projects">{{ .Title }}</a> <a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
{{ else }} {{ else }}
<a class="nav-item" href="{{ .RelPermalink }}"> <a class="nav-item" href="{{ .RelPermalink }}">
{{ if $pageIsInProjects }} {{ if $pageIsInProjects }}
@ -40,7 +39,7 @@
{{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }} {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "section" "blog" }} {{ with .Site.GetPage "section" "blog" }}
{{ if $isHome }} {{ if $isHome }}
<a class="nav-item" href="#blog">{{ .Title }}</a> <a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
{{ else }} {{ else }}
<a class="nav-item" href="{{ .RelPermalink }}"> <a class="nav-item" href="{{ .RelPermalink }}">
{{ if $pageIsInBlog }} {{ if $pageIsInBlog }}
@ -54,7 +53,7 @@
{{ end }} {{ end }}
{{ with .Site.GetPage "page" "contact" }} {{ with .Site.GetPage "page" "contact" }}
<a class="nav-item" href="{{ if $isHome }}#contact{{ else }}{{ "/#contact" | relLangURL }}{{ end }}">{{ .Title }}</a> <a class="nav-item" href="{{ if $isHome }}#{{ .Title | urlize }}{{ else }}{{ printf "/#%s" (.Title | urlize) | relLangURL }}{{ end }}">{{ .Title }}</a>
{{ end }} {{ end }}
{{ range $.Site.Home.AllTranslations.ByWeight }} {{ range $.Site.Home.AllTranslations.ByWeight }}

View file

@ -1,5 +1,5 @@
{{ with .Site.GetPage "section" "projects" }} {{ with .Site.GetPage "section" "projects" }}
<div class="section" id="projects"> <div class="section" id="{{ .Title | urlize }}">
<!-- Begin Projects container --> <!-- Begin Projects container -->
<div class="container"> <div class="container">
<h2 class="title is-2 has-text-centered"> <h2 class="title is-2 has-text-centered">