mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-12-22 22:52:54 +00:00
Render ancors from titles
This commit is contained in:
parent
ae90b40388
commit
db98ff7573
4 changed files with 8 additions and 9 deletions
|
@ -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">
|
||||||
|
|
|
@ -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 }}
|
||||||
|
|
|
@ -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 }}
|
||||||
|
|
|
@ -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">
|
||||||
|
|
Loading…
Reference in a new issue