File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 {{- $target := .target | default "blank" -}}
55 {{- $targetAttr := "_blank" -}}
66 {{- if eq $target "self" -}}{{- $targetAttr = "_self" -}}{{- end -}}
7- < a href ="{{ if .repo }}{{ .repo }}{{ else if .url }}{{ .url }}{{ else }}javascript:void(0){{ end }} " {{ if or
8- .repo .url }}target ="{{ $targetAttr }} " rel ="noopener " {{ end }} >
7+ {{/* Process internal links (not http[s]://) */}}
8+ {{- $projectURL := .url -}}
9+ {{- if and $projectURL (not (or (hasPrefix $projectURL "http://") (hasPrefix $projectURL "https://"))) -}}
10+ {{- $projectURL = partial "helpers/get-page-url.html" $projectURL -}}
11+ {{- end -}}
12+ < a href ="{{ if .repo }}{{ .repo }}{{ else if $projectURL }}{{ $projectURL }}{{ else }}javascript:void(0){{ end }} " {{ if or
13+ .repo $projectURL }}target ="{{ $targetAttr }} " rel ="noopener " {{ end }} >
914 {{ if .image }}
1015 < div class ="card-head ">
1116 {{ $imageImage:= resources.Get .image}}
@@ -80,9 +85,9 @@ <h5 class="card-title mb-0">{{ .name }}</h5>
8085 <!-- Place this tag where you want the button to render. -->
8186 < a class ="github-button project-btn d-none " href ="{{ .repo }} " data-icon ="octicon-standard "
8287 data-show-count ="true " aria-label ="Star {{ .name }} "> {{ i18n "project_star" }}</ a >
83- {{ else if .url }}
88+ {{ else if $projectURL }}
8489 < span >
85- < a class ="btn btn-outline-info btn-sm " href ="{{ .url }} " target ="{{ $targetAttr }} " rel ="noopener "> {{ i18n "project_details" }}</ a >
90+ < a class ="btn btn-outline-info btn-sm " href ="{{ $projectURL }} " target ="{{ $targetAttr }} " rel ="noopener "> {{ i18n "project_details" }}</ a >
8691 </ span >
8792 {{ end }}
8893 </ div >
Original file line number Diff line number Diff line change @@ -86,8 +86,13 @@ <h5>{{ i18n "navigation" }}</h5>
8686 {{ if $customMenusEnabled }}
8787 {{ range $customMenus }}
8888 {{ if .showOnFooter }}
89+ {{ $menuURL := .url }}
90+ {{/* Process internal links (not http[s]://) */}}
91+ {{ if not (or (hasPrefix $menuURL "http://") (hasPrefix $menuURL "https://")) }}
92+ {{ $menuURL = partial "helpers/get-page-url.html" $menuURL }}
93+ {{ end }}
8994 < li class ="nav-item ">
90- < a class ="smooth-scroll " href ="{{ .url }} "> {{ .name }}</ a >
95+ < a class ="smooth-scroll " href ="{{ $menuURL }} "> {{ .name }}</ a >
9196 </ li >
9297 {{ end }}
9398 {{ end }}
Original file line number Diff line number Diff line change 1+ {{- path.Join (site.BaseURL | relLangURL) (strings.Trim . "/") -}}
Original file line number Diff line number Diff line change 11{{- if page.IsHome -}}
22 #{{ partial "helpers/get-section-id.html" . }}
33{{- else -}}
4- {{ site.BaseURL | relLangURL }}#{{ partial "helpers/get-section-id.html" . }}
5- {{- end -}}
4+ {{ partial "helpers/get-page-url.html" "" }}#{{ partial "helpers/get-section-id.html" . }}
5+ {{- end -}}
Original file line number Diff line number Diff line change 7979 < i data-feather ="sidebar "> </ i >
8080 </ button >
8181 {{ end }}
82- < a class ="navbar-brand " href ="{{ site.BaseURL | relLangURL }} ">
82+ < a class ="navbar-brand " href ="{{ partial " helpers /get-page-url.html" "" }}">
8383 {{ if $logo }}
8484 < img src ="{{ $logo }} " id ="logo " alt ="Logo ">
8585 {{ end }}
9999 < div class ="collapse navbar-collapse dynamic-navbar " id ="top-nav-items ">
100100 < ul class ="nav navbar-nav ms-auto ">
101101 < li class ="nav-item ">
102- < a class ="nav-link " href ="{{ if .IsHome }}#home{{else}}{{ site.BaseURL | relLangURL }}#home{{end}} "> {{ i18n "home" }}</ a >
102+ < a class ="nav-link " href ="{{ if .IsHome }}#home{{else}}{{ partial " helpers /get-page-url.html" "" }}#home{{end}}"> {{ i18n "home" }}</ a >
103103 </ li >
104104 {{ if $sections }}
105105 {{ $sectionCount := 1 }}
136136 {{ end }}
137137 {{ if $blogEnabled }}
138138 < li class ="nav-item ">
139- < a class ="nav-link " id ="blog-link " href ="{{ path.Join (site.BaseURL | relLangURL) $blogSection }} "> {{ $blogTitle }}</ a >
139+ < a class ="nav-link " id ="blog-link " href ="{{ partial " helpers /get-page-url.html" $blogSection }}"> {{ $blogTitle }}</ a >
140140 </ li >
141141 {{ end }}
142142 {{ if $notesEnabled }}
143143 < li class ="nav-item ">
144- < a class ="nav-link " id ="note-link " href ="{{ path.Join (site.BaseURL | relLangURL) "notes " }}"> {{ $notesTitle }}</ a >
144+ < a class ="nav-link " id ="note-link " href ="{{ partial " helpers /get-page-url.html" "notes" }}"> {{ $notesTitle }}</ a >
145145 </ li >
146146 {{ end }}
147147 {{ range $customMenus }}
148148 {{ if (not .hideFromNavbar) }}
149+ {{ $menuURL := .url }}
150+ {{/* Process internal links (not http[s]://) */}}
151+ {{ if not (or (hasPrefix $menuURL "http://") (hasPrefix $menuURL "https://")) }}
152+ {{ $menuURL = partial "helpers/get-page-url.html" $menuURL }}
153+ {{ end }}
149154 < li class ="nav-item ">
150- < a class ="nav-link " href ="{{ .url }} "> {{ .name }}</ a >
155+ < a class ="nav-link " href ="{{ $menuURL }} "> {{ .name }}</ a >
151156 </ li >
152157 {{ end }}
153158 {{ end }}
You can’t perform that action at this time.
0 commit comments