2023-10-22 00:07:40

This commit is contained in:
z17CX 2023-10-22 00:07:40 +00:00
parent 4f994267f3
commit 7e64682ec4
Signed by: z17cx
GPG key ID: 3F5F87C84EE943E4
4 changed files with 29 additions and 13 deletions

View file

@ -31,6 +31,20 @@
"type" "image/svg+xml" "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 {{ $mainfest := (dict
"id" (("/") | absURL) "id" (("/") | absURL)
"name" (site.Title) "name" (site.Title)
@ -44,6 +58,8 @@
"orientation" "any" "orientation" "any"
"categories" ($data.Get "categories") "categories" ($data.Get "categories")
"icons" ($data.Get "icons") "icons" ($data.Get "icons")
) }} "chrome_settings_overrides" (dict
"search_provider" ($search_provider)
)) }}
{{ (($mainfest) | jsonify) }} {{ (($mainfest) | jsonify) }}

View file

@ -1,5 +1,4 @@
{{- $cfg := (site.Params) -}} {{- $cfg := (site.Params) -}}
{{- $url := (urls.Parse (site.BaseURL)) -}}
{{ ((printf "<?xml version='1.0' encoding='utf-8'?>") | safeHTML) }} {{ ((printf "<?xml version='1.0' encoding='utf-8'?>") | safeHTML) }}
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
@ -18,9 +17,9 @@
<Language>{{ (site.LanguageCode) }}</Language> <Language>{{ (site.LanguageCode) }}</Language>
<OutputEncoding>UTF-8</OutputEncoding> <OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding> <InputEncoding>UTF-8</InputEncoding>
<moz:SearchForm>https://google.com/search?as_sitesearch={{ ($url.Host) }}&amp;q={searchTerms}</moz:SearchForm> <moz:SearchForm>https://google.com/search?as_sitesearch={{ ((urls.Parse (site.BaseURL)).Host) }}&amp;q={searchTerms}</moz:SearchForm>
<Url type="text/html" method="get" <Url type="text/html" method="get"
template="https://google.com/search?as_sitesearch={{ ($url.Host) }}&amp;q={searchTerms}"/> template="https://google.com/search?as_sitesearch={{ ((urls.Parse (site.BaseURL)).Host) }}&amp;q={searchTerms}"/>
<Url type="application/opensearchdescription+xml" rel="self" <Url type="application/opensearchdescription+xml" rel="self"
template='{{ (("opensearch.xml") | absLangURL) }}'/> template='{{ (("opensearch.xml") | absLangURL) }}'/>
</OpenSearchDescription> </OpenSearchDescription>

View file

@ -71,6 +71,9 @@
<!--[ / languages ]--> <!--[ / languages ]-->
<!--[ output-formats ]--> <!--[ 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) }} {{ range (.AlternativeOutputFormats) }}
<link rel="{{ (.Rel) }}" type="{{ (.MediaType.Type) }}" href="{{ ((.Permalink) | safeURL) }}" title="{{ (site.Title) }}"/> <link rel="{{ (.Rel) }}" type="{{ (.MediaType.Type) }}" href="{{ ((.Permalink) | safeURL) }}" title="{{ (site.Title) }}"/>
{{ end }} {{ end }}

View file

@ -1,21 +1,19 @@
{{ $url := (urls.Parse (site.BaseURL)) }} {{ $url := (urls.Parse (site.BaseURL)) }}
{{ $urlYa := "" }} {{ $domain := "" }}{{ $icon := "" }}
{{ $iconYa := "" }}
{{ if (eq ($.Language.Lang) ("ru")) }} {{ if (eq ($.Language.Lang) ("ru")) }}
{{ $urlYa = "https://yandex.ru" }} {{ $domain = "yandex.ru" }}
{{ $iconYa = "yandex" }} {{ $icon = "yandex" }}
{{ else }} {{ else }}
{{ $urlYa = "https://yandex.com" }} {{ $domain = "yandex.com" }}
{{ $iconYa = "yandex-international" }} {{ $icon = "yandex-international" }}
{{ end }} {{ 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) }}"/> <input type="hidden" name="site" value="{{ ($url.Host) }}"/>
<div class="input-group"> <div class="input-group">
<span class="input-group-text"><i class="fas fa-search fa-fw"></i></span> <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") }}'/> <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> </div>
</form> </form>