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! -->
|
||||
{{ with .Site.GetPage "page" "about" }}
|
||||
<div class="section" id="about">
|
||||
<div class="section" id="{{ .Title | urlize }}">
|
||||
<div class="container">
|
||||
<h2 class="title is-2 has-text-centered">{{ .Title }}</h2>
|
||||
<div class="columns"><!-- Avatar and about.md side by side except mobile -->
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
<!-- Let's chat, shall we? -->
|
||||
{{ with .Site.GetPage "page" "contact" }}
|
||||
<div class="section" id="contact">
|
||||
<div class="section" id="{{ .Title | urlize }}">
|
||||
<div class="container has-text-centered">
|
||||
<h2 class="title is-2">{{ .Title }}</h2>
|
||||
<div class="markdown">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ with .Site.GetPage "section" "blog" }}
|
||||
<div class="section" id="blog">
|
||||
<div class="section" id="{{ .Title | urlize }}">
|
||||
<!-- Begin Blog container -->
|
||||
<div class="container">
|
||||
{{ if .Site.Params.showLatest }}
|
||||
|
|
|
@ -14,16 +14,15 @@
|
|||
{{ if not $isHome }}
|
||||
<a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a>
|
||||
{{ end }}
|
||||
|
||||
{{ 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 }}
|
||||
|
||||
{{ $pageIsInProjects := eq .Page.Section "projects"}}
|
||||
{{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }}
|
||||
{{ with .Site.GetPage "section" "projects" }}
|
||||
{{ if $isHome }}
|
||||
<a class="nav-item" href="#projects">{{ .Title }}</a>
|
||||
<a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
|
||||
{{ else }}
|
||||
<a class="nav-item" href="{{ .RelPermalink }}">
|
||||
{{ if $pageIsInProjects }}
|
||||
|
@ -40,7 +39,7 @@
|
|||
{{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }}
|
||||
{{ with .Site.GetPage "section" "blog" }}
|
||||
{{ if $isHome }}
|
||||
<a class="nav-item" href="#blog">{{ .Title }}</a>
|
||||
<a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
|
||||
{{ else }}
|
||||
<a class="nav-item" href="{{ .RelPermalink }}">
|
||||
{{ if $pageIsInBlog }}
|
||||
|
@ -54,7 +53,7 @@
|
|||
{{ end }}
|
||||
|
||||
{{ 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 }}
|
||||
|
||||
{{ range $.Site.Home.AllTranslations.ByWeight }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ with .Site.GetPage "section" "projects" }}
|
||||
<div class="section" id="projects">
|
||||
<div class="section" id="{{ .Title | urlize }}">
|
||||
<!-- Begin Projects container -->
|
||||
<div class="container">
|
||||
<h2 class="title is-2 has-text-centered">
|
||||
|
|
Loading…
Reference in a new issue