Make links language-relative
This ensures that links work correctly in languages other than English. For example, clicking on the navbar "brand" link used to take you to the English home page even if you were browsing the site in another language. Now it takes you to the home page for that language.
This commit is contained in:
parent
655c2011fe
commit
c4cfe47e01
@ -53,7 +53,7 @@
|
|||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
<span class="post-meta">
|
<span class="post-meta">
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
#<a href="/tags/{{ . | urlize }}">{{ . }}</a>
|
#<a href="{{ $.Site.LanguagePrefix }}/tags/{{ . | urlize }}">{{ . }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<article class="post-preview">
|
<article class="post-preview">
|
||||||
<div class="list-group col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-3">
|
<div class="list-group col-lg-4 col-lg-offset-4 col-md-6 col-md-offset-3">
|
||||||
{{ range $key, $value := .Data.Terms.ByCount }}
|
{{ range $key, $value := .Data.Terms.ByCount }}
|
||||||
<a href="/{{ $data.Plural }}/{{ $value.Name | urlize }}" class="list-group-item">
|
<a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}" class="list-group-item">
|
||||||
{{ $value.Name }}<span class="badge">{{ $value.Count }}</span></a>
|
{{ $value.Name }}<span class="badge">{{ $value.Count }}</span></a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
<span class="post-meta">
|
<span class="post-meta">
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
#<a href="/tags/{{ . | urlize }}">{{ . }}</a>
|
#<a href="{{ $.Site.LanguagePrefix }}/tags/{{ . | urlize }}">{{ . }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Site.Params.rss }}
|
{{ if .Site.Params.rss }}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ .Site.BaseURL}}/index.xml" title="RSS">
|
<a href="{{ "/index.xml" | absLangURL }}" title="RSS">
|
||||||
<span class="fa-stack fa-lg">
|
<span class="fa-stack fa-lg">
|
||||||
<i class="fa fa-circle fa-stack-2x"></i>
|
<i class="fa fa-circle fa-stack-2x"></i>
|
||||||
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>
|
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
{{ if .Site.Title }}
|
{{ if .Site.Title }}
|
||||||
•
|
•
|
||||||
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
|
<a href="{{ "/" | absLangURL }}">{{ .Site.Title }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</p>
|
</p>
|
||||||
<!-- Please don't remove this, keep my open source work credited :) -->
|
<!-- Please don't remove this, keep my open source work credited :) -->
|
||||||
@ -76,4 +76,4 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
{{ template "_internal/google_analytics.html" . }}
|
||||||
{{- partial "footer_custom.html" . }}
|
{{- partial "footer_custom.html" . }}
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
<!-- Hugo Version number -->
|
<!-- Hugo Version number -->
|
||||||
{{ .Hugo.Generator -}}
|
{{ .Hugo.Generator -}}
|
||||||
<!-- Links and stylesheets -->
|
<!-- Links and stylesheets -->
|
||||||
<link rel="canonical" href="{{ .URL | absURL }}" />
|
<link rel="canonical" href="{{ .URL | absLangURL }}" />
|
||||||
<link rel="alternate" href="{{ "/index.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
<link rel="alternate" href="{{ "/index.xml" | absLangURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
|
<a class="navbar-brand" href="{{ "/" | absLangURL }}">{{ .Site.Title }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="main-navbar">
|
<div class="collapse navbar-collapse" id="main-navbar">
|
||||||
@ -18,13 +18,13 @@
|
|||||||
<a class="navlinks-parent" href="javascript:void(0)">{{ .Name }}</a>
|
<a class="navlinks-parent" href="javascript:void(0)">{{ .Name }}</a>
|
||||||
<div class="navlinks-children">
|
<div class="navlinks-children">
|
||||||
{{ range .Children }}
|
{{ range .Children }}
|
||||||
<a href="{{ .URL }}">{{ .Name }}</a>
|
<a href="{{ .URL | relLangURL }}">{{ .Name }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<li>
|
<li>
|
||||||
<a title="{{ .Name }}" href="{{ .URL }}">{{ .Name }}</a>
|
<a title="{{ .Name }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<div class="avatar-container">
|
<div class="avatar-container">
|
||||||
<div class="avatar-img-border">
|
<div class="avatar-img-border">
|
||||||
{{ if isset .Site.Params "logo" }}
|
{{ if isset .Site.Params "logo" }}
|
||||||
<a title="{{ .Site.Title }}" href="{{ .Site.BaseURL }}">
|
<a title="{{ .Site.Title }}" href="{{ "/" | absLangURL }}">
|
||||||
<img class="avatar-img" src="{{ .Site.BaseURL }}/{{ .Site.Params.logo }}" alt="{{ .Site.Title }}" />
|
<img class="avatar-img" src="{{ .Site.BaseURL }}/{{ .Site.Params.logo }}" alt="{{ .Site.Title }}" />
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user