2023-10-22 00:07:40
This commit is contained in:
parent
4f994267f3
commit
7e64682ec4
4 changed files with 29 additions and 13 deletions
|
@ -31,6 +31,20 @@
|
|||
"type" "image/svg+xml"
|
||||
)) }}
|
||||
|
||||
{{ $ya := "" }}
|
||||
{{ if (eq ($lang) ("ru")) }}{{ $ya = "yandex.ru" }}{{ else }}{{ $ya = "yandex.com" }}{{ end }}
|
||||
|
||||
{{ $search_provider := (dict
|
||||
"name" (site.Title)
|
||||
"search_url" (printf "https://google.com/search?as_sitesearch=%s&q={searchTerms}" ((urls.Parse (site.BaseURL)).Host))
|
||||
"alternate_urls" (slice
|
||||
(printf "https://%s/yandsearch?site=%s&text={searchTerms}" ($ya) ((urls.Parse (site.BaseURL)).Host))
|
||||
(printf "https://bing.com/search?q1=site:%s&q={searchTerms}" ((urls.Parse (site.BaseURL)).Host))
|
||||
)
|
||||
"favicon_url" (("favicon.ico") | absURL)
|
||||
"encoding" "UTF-8"
|
||||
) }}
|
||||
|
||||
{{ $mainfest := (dict
|
||||
"id" (("/") | absURL)
|
||||
"name" (site.Title)
|
||||
|
@ -44,6 +58,8 @@
|
|||
"orientation" "any"
|
||||
"categories" ($data.Get "categories")
|
||||
"icons" ($data.Get "icons")
|
||||
) }}
|
||||
"chrome_settings_overrides" (dict
|
||||
"search_provider" ($search_provider)
|
||||
)) }}
|
||||
|
||||
{{ (($mainfest) | jsonify) }}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{{- $cfg := (site.Params) -}}
|
||||
{{- $url := (urls.Parse (site.BaseURL)) -}}
|
||||
|
||||
{{ ((printf "<?xml version='1.0' encoding='utf-8'?>") | safeHTML) }}
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
|
||||
|
@ -18,9 +17,9 @@
|
|||
<Language>{{ (site.LanguageCode) }}</Language>
|
||||
<OutputEncoding>UTF-8</OutputEncoding>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<moz:SearchForm>https://google.com/search?as_sitesearch={{ ($url.Host) }}&q={searchTerms}</moz:SearchForm>
|
||||
<moz:SearchForm>https://google.com/search?as_sitesearch={{ ((urls.Parse (site.BaseURL)).Host) }}&q={searchTerms}</moz:SearchForm>
|
||||
<Url type="text/html" method="get"
|
||||
template="https://google.com/search?as_sitesearch={{ ($url.Host) }}&q={searchTerms}"/>
|
||||
template="https://google.com/search?as_sitesearch={{ ((urls.Parse (site.BaseURL)).Host) }}&q={searchTerms}"/>
|
||||
<Url type="application/opensearchdescription+xml" rel="self"
|
||||
template='{{ (("opensearch.xml") | absLangURL) }}'/>
|
||||
</OpenSearchDescription>
|
||||
|
|
|
@ -71,6 +71,9 @@
|
|||
<!--[ / languages ]-->
|
||||
|
||||
<!--[ output-formats ]-->
|
||||
<link rel="manifest" type="application/manifest+json" href="{{ ("manifest.json" | absLangURL) }}" title="{{ (site.Title) }}"/>
|
||||
<link rel="search" type="application/opensearchdescription+xml" href="{{ ("opensearch.xml" | absLangURL) }}" title="{{ (site.Title) }}"/>
|
||||
|
||||
{{ range (.AlternativeOutputFormats) }}
|
||||
<link rel="{{ (.Rel) }}" type="{{ (.MediaType.Type) }}" href="{{ ((.Permalink) | safeURL) }}" title="{{ (site.Title) }}"/>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
{{ $url := (urls.Parse (site.BaseURL)) }}
|
||||
|
||||
{{ $urlYa := "" }}
|
||||
{{ $iconYa := "" }}
|
||||
|
||||
{{ $domain := "" }}{{ $icon := "" }}
|
||||
{{ if (eq ($.Language.Lang) ("ru")) }}
|
||||
{{ $urlYa = "https://yandex.ru" }}
|
||||
{{ $iconYa = "yandex" }}
|
||||
{{ $domain = "yandex.ru" }}
|
||||
{{ $icon = "yandex" }}
|
||||
{{ else }}
|
||||
{{ $urlYa = "https://yandex.com" }}
|
||||
{{ $iconYa = "yandex-international" }}
|
||||
{{ $domain = "yandex.com" }}
|
||||
{{ $icon = "yandex-international" }}
|
||||
{{ end }}
|
||||
|
||||
<form action="{{ ($urlYa) }}/yandsearch" method="get" class="d-flex" target="_blank">
|
||||
<form action="https://{{ ($domain) }}/yandsearch" method="get" class="d-flex" target="_blank">
|
||||
<input type="hidden" name="site" value="{{ ($url.Host) }}"/>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-search fa-fw"></i></span>
|
||||
<input type="search" class="form-control" name="text" placeholder='{{ (i18n "search_yandex") }}' aria-label='{{ (i18n "search_yandex") }}'/>
|
||||
<span class="input-group-text"><i class="fab fa-{{ ($iconYa) }} fa-fw"></i></span>
|
||||
<span class="input-group-text"><i class="fab fa-{{ ($icon) }} fa-fw"></i></span>
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue