mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-18 07:23:09 +00:00
@@ -32,6 +32,15 @@
|
|||||||
|
|
||||||
// Event listener for language selection
|
// Event listener for language selection
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
// override stored language when query string contains force is true
|
||||||
|
let params = new URLSearchParams(document.location.search)
|
||||||
|
let force = params.get('force')
|
||||||
|
if (force !== null && force.toLowerCase() == 'true') {
|
||||||
|
setLanguage(document.documentElement.lang)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// continue with regular code
|
||||||
const storedLanguage = getLanguage()
|
const storedLanguage = getLanguage()
|
||||||
const languageItems = document.querySelectorAll('#language-selector .dropdown-item')
|
const languageItems = document.querySelectorAll('#language-selector .dropdown-item')
|
||||||
|
|
||||||
|
@@ -63,6 +63,15 @@ arguments:
|
|||||||
default: false
|
default: false
|
||||||
comment: >-
|
comment: >-
|
||||||
Flag to indicate if a link that contains baseURL host should be forced as external.
|
Flag to indicate if a link that contains baseURL host should be forced as external.
|
||||||
|
force:
|
||||||
|
type: bool
|
||||||
|
optional: true
|
||||||
|
default: false
|
||||||
|
comment: >-
|
||||||
|
Flag to indicate a link should bypass any language redirection. Only applicable when
|
||||||
|
the site param `enableLanguageSelectionStorage` is set to true. When `force` is true,
|
||||||
|
the link to a local page is kept as is.
|
||||||
|
release: v0.27.20
|
||||||
class:
|
class:
|
||||||
type: string
|
type: string
|
||||||
optional: true
|
optional: true
|
||||||
|
@@ -316,7 +316,7 @@ As an example, the following shortcodes render links in different formats.
|
|||||||
- {{</* link url="../projects/another-project" case=false /*/>}}
|
- {{</* link url="../projects/another-project" case=false /*/>}}
|
||||||
- {{</* link "about" /*/>}}
|
- {{</* link "about" /*/>}}
|
||||||
- {{</* link "/fr/a-propos/" /*/>}}
|
- {{</* link "/fr/a-propos/" /*/>}}
|
||||||
- {{</* link "/fr/a-propos" >}}About (French){{< /link */>}}
|
- {{</* link href="/fr/a-propos" force=true >}}About (French){{< /link */>}}
|
||||||
- {{</* link "#image" /*/>}}
|
- {{</* link "#image" /*/>}}
|
||||||
- {{</* link "components/#map" /*/>}}
|
- {{</* link "components/#map" /*/>}}
|
||||||
|
|
||||||
|
@@ -298,7 +298,7 @@ Utilisez le shortcode `file` pour afficher et mettre en évidence le contenu com
|
|||||||
- {{</* link url="../projects/another-project" case=false /*/>}}
|
- {{</* link url="../projects/another-project" case=false /*/>}}
|
||||||
- {{</* link "about" /*/>}}
|
- {{</* link "about" /*/>}}
|
||||||
- {{</* link "/en/about/" /*/>}}
|
- {{</* link "/en/about/" /*/>}}
|
||||||
- {{</* link "/en/about" >}}About (Anglais){{< /link */>}}
|
- {{</* link url="/en/about/" force=true >}}About (Anglais){{< /link */>}}
|
||||||
- {{</* link "#image" /*/>}}
|
- {{</* link "#image" /*/>}}
|
||||||
- {{</* link "components/#map" /*/>}}
|
- {{</* link "components/#map" /*/>}}
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
{{- $rel := "" -}}
|
{{- $rel := "" -}}
|
||||||
{{- $case := .case | default true }}
|
{{- $case := .case | default true }}
|
||||||
{{- $external := .external | default false }}
|
{{- $external := .external | default false }}
|
||||||
|
{{- $force := .force | default false }}
|
||||||
{{- $cue := .cue | default site.Params.main.externalLinks.cue -}}
|
{{- $cue := .cue | default site.Params.main.externalLinks.cue -}}
|
||||||
{{- $tab := .tab | default site.Params.main.externalLinks.tab -}}
|
{{- $tab := .tab | default site.Params.main.externalLinks.tab -}}
|
||||||
{{- $pretty := site.Params.main.internalLinks.pretty | default false }}
|
{{- $pretty := site.Params.main.internalLinks.pretty | default false }}
|
||||||
@@ -104,6 +105,14 @@
|
|||||||
{{ if and $pretty (not (hasSuffix $destination "/" )) (not (strings.Contains $destination "#")) }}
|
{{ if and $pretty (not (hasSuffix $destination "/" )) (not (strings.Contains $destination "#")) }}
|
||||||
{{ $destination = printf "%s/" $destination }}
|
{{ $destination = printf "%s/" $destination }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $force }}
|
||||||
|
{{ if strings.Contains $destination "?" }}
|
||||||
|
{{ $destination = printf "%s&force=true" $destination }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $destination = printf "%s?force=true" $destination }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{ if not $error -}}
|
{{ if not $error -}}
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
{{ $class := "" }}
|
{{ $class := "" }}
|
||||||
{{ $case := true }}
|
{{ $case := true }}
|
||||||
{{ $external := false }}
|
{{ $external := false }}
|
||||||
|
{{ $force := false }}
|
||||||
{{ $cue := site.Params.main.externalLinks.cue }}
|
{{ $cue := site.Params.main.externalLinks.cue }}
|
||||||
{{ $tab := site.Params.main.externalLinks.tab }}
|
{{ $tab := site.Params.main.externalLinks.tab }}
|
||||||
{{ $text := trim .Inner " \r\n" | .Page.RenderString | safeHTML }}
|
{{ $text := trim .Inner " \r\n" | .Page.RenderString | safeHTML }}
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
{{- $case = .Get "case" | default true -}}
|
{{- $case = .Get "case" | default true -}}
|
||||||
{{- $external = .Get "external" | default false -}}
|
{{- $external = .Get "external" | default false -}}
|
||||||
{{- $class = .Get "class" | default "" -}}
|
{{- $class = .Get "class" | default "" -}}
|
||||||
|
{{- $force = .Get "force" | default false -}}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $href = .Get 0 }}
|
{{ $href = .Get 0 }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -99,5 +101,5 @@
|
|||||||
|
|
||||||
<!-- Main code -->
|
<!-- Main code -->
|
||||||
{{- if not $error -}}
|
{{- if not $error -}}
|
||||||
{{ partial "assets/link.html" (dict "destination" $url "text" $text "cue" $cue "tab" $tab "case" $case "external" $external "class" $class "page" .Page) }}
|
{{ partial "assets/link.html" (dict "destination" $url "text" $text "cue" $cue "tab" $tab "case" $case "external" $external "force" $force "class" $class "page" .Page) }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@gethinode/hinode",
|
"name": "@gethinode/hinode",
|
||||||
"version": "0.27.19",
|
"version": "0.27.20",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@gethinode/hinode",
|
"name": "@gethinode/hinode",
|
||||||
"version": "0.27.19",
|
"version": "0.27.20",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fullhuman/postcss-purgecss": "^7.0.2",
|
"@fullhuman/postcss-purgecss": "^7.0.2",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@gethinode/hinode",
|
"name": "@gethinode/hinode",
|
||||||
"version": "0.27.19",
|
"version": "0.27.20",
|
||||||
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
|
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"hugo",
|
"hugo",
|
||||||
|
Reference in New Issue
Block a user