mirror of
https://git.adityakumar.xyz/hugo-theme-even.git
synced 2024-11-08 14:39:44 +00:00
fix: allow all url protocols in social and menu links (#4)
Adding "| safeURL" allows the usage of "unsafe" url protocols such as irc:// or xmpp://
This commit is contained in:
parent
d6ac9cd9ce
commit
8384f02483
4 changed files with 4 additions and 8 deletions
|
@ -84,7 +84,7 @@ copyright = "" # default: author.name ↓ # 默认为下面配
|
|||
alipay = "/path/to/your/alipay-qr-code.png" # 支付宝二维码
|
||||
|
||||
[params.social] # 社交链接
|
||||
a-email = "your@email.com"
|
||||
a-email = "mailto:your@email.com"
|
||||
b-stack-overflow = "http://localhost:1313"
|
||||
c-twitter = "http://localhost:1313"
|
||||
d-facebook = "http://localhost:1313"
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
{{- range $name, $path := .Site.Params.social }}
|
||||
{{- if $path }}
|
||||
{{- $realName := slicestr $name 2 }}
|
||||
{{- if eq $realName "email" }}
|
||||
<a href="mailto:{{ $path }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a>
|
||||
{{- else }}
|
||||
<a href="{{ $path }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a>
|
||||
{{- end }}
|
||||
<a href="{{ $path | safeURL }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
<a href="{{ .Site.RSSLink }}" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<ul id="menu" class="menu">
|
||||
{{ range .Site.Menus.main -}}
|
||||
<li class="menu-item">
|
||||
<a class="menu-item-link" href="{{ .URL }}">{{ .Name }}</a>
|
||||
<a class="menu-item-link" href="{{ .URL | safeURL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<nav id="mobile-menu" class="mobile-menu slideout-menu">
|
||||
<ul class="mobile-menu-list">
|
||||
{{ range .Site.Menus.main -}}
|
||||
<a href="{{ .URL }}">
|
||||
<a href="{{ .URL | safeURL }}">
|
||||
<li class="mobile-menu-item">{{ .Name }}</li>
|
||||
</a>
|
||||
{{- end }}
|
||||
|
|
Loading…
Reference in a new issue