From 7e64682ec44544c52ac613b40557092326b285ea Mon Sep 17 00:00:00 2001 From: KitsuneSolar Date: Sun, 22 Oct 2023 00:07:40 +0000 Subject: [PATCH] 2023-10-22 00:07:40 --- layouts/index.manifest.json | 18 +++++++++++++++++- layouts/index.opensearch.xml | 5 ++--- layouts/partials/head.html | 3 +++ .../partials/module/search/form.yandex.html | 16 +++++++--------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/layouts/index.manifest.json b/layouts/index.manifest.json index 30d703f..8f1b846 100644 --- a/layouts/index.manifest.json +++ b/layouts/index.manifest.json @@ -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) }} diff --git a/layouts/index.opensearch.xml b/layouts/index.opensearch.xml index 0809225..b150a3f 100644 --- a/layouts/index.opensearch.xml +++ b/layouts/index.opensearch.xml @@ -1,5 +1,4 @@ {{- $cfg := (site.Params) -}} -{{- $url := (urls.Parse (site.BaseURL)) -}} {{ ((printf "") | safeHTML) }} {{ (site.LanguageCode) }} UTF-8 UTF-8 - https://google.com/search?as_sitesearch={{ ($url.Host) }}&q={searchTerms} + https://google.com/search?as_sitesearch={{ ((urls.Parse (site.BaseURL)).Host) }}&q={searchTerms} + template="https://google.com/search?as_sitesearch={{ ((urls.Parse (site.BaseURL)).Host) }}&q={searchTerms}"/> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4cac5d1..871fcd2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -71,6 +71,9 @@ + + + {{ range (.AlternativeOutputFormats) }} {{ end }} diff --git a/layouts/partials/module/search/form.yandex.html b/layouts/partials/module/search/form.yandex.html index 0030d6e..2fe6d0d 100644 --- a/layouts/partials/module/search/form.yandex.html +++ b/layouts/partials/module/search/form.yandex.html @@ -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 }} -
+
- +