mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
feat: use .RelPermalink
for search JSON (#859)
Avoids CORS problem when the user inputs `baseurl` incorrectly.
This commit is contained in:
parent
f7e442cabb
commit
1668ebc3e4
1 changed files with 2 additions and 2 deletions
|
@ -1,11 +1,11 @@
|
||||||
{{ define "body-class" }}template-search{{ end }}
|
{{ define "body-class" }}template-search{{ end }}
|
||||||
{{ define "head" }}
|
{{ define "head" }}
|
||||||
{{- with .OutputFormats.Get "json" -}}
|
{{- with .OutputFormats.Get "json" -}}
|
||||||
<link rel="preload" href="{{ .Permalink }}" as="fetch" crossorigin="anonymous">
|
<link rel="preload" href="{{ .RelPermalink }}" as="fetch" crossorigin="anonymous">
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<form action="{{ .Permalink }}" class="search-form"{{ with .OutputFormats.Get "json" -}} data-json="{{ .Permalink }}"{{- end }}>
|
<form action="{{ .RelPermalink }}" class="search-form"{{ with .OutputFormats.Get "json" -}} data-json="{{ .RelPermalink }}"{{- end }}>
|
||||||
<p>
|
<p>
|
||||||
<label>{{ T "search.title" }}</label>
|
<label>{{ T "search.title" }}</label>
|
||||||
<input name="keyword" placeholder="{{ T `search.placeholder` }}" />
|
<input name="keyword" placeholder="{{ T `search.placeholder` }}" />
|
||||||
|
|
Loading…
Reference in a new issue