aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2024-05-10 15:25:20 -0700
committerBjørn Erik Pedersen <[email protected]>2024-05-14 10:24:17 +0200
commit87ab7f7ffce82f1c7a264f1f7daa97f13dc77fde (patch)
tree62fbbe9df07d96dd9d0fffeb6ab9fb63aba355d3
parentee26e69ce3367ebfe1e35f03695d51b049aab955 (diff)
downloadhugo-87ab7f7ffce82f1c7a264f1f7daa97f13dc77fde.tar.gz
hugo-87ab7f7ffce82f1c7a264f1f7daa97f13dc77fde.zip
tpl/tplimpl: Improve locale value in opengraph.html
Closes #12480
-rw-r--r--tpl/tplimpl/embedded/templates/opengraph.html4
-rw-r--r--tpl/tplimpl/tplimpl_integration_test.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/tpl/tplimpl/embedded/templates/opengraph.html b/tpl/tplimpl/embedded/templates/opengraph.html
index a9b348e9e..59e63d6be 100644
--- a/tpl/tplimpl/embedded/templates/opengraph.html
+++ b/tpl/tplimpl/embedded/templates/opengraph.html
@@ -12,8 +12,8 @@
<meta property="og:description" content="{{ . }}">
{{- end }}
-{{- with or .Params.locale site.Language.LanguageCode site.Language.Lang }}
- <meta property="og:locale" content="{{ . }}">
+{{- with or .Params.locale site.Language.LanguageCode }}
+ <meta property="og:locale" content="{{ replace . `-` `_` }}">
{{- end }}
{{- if .IsPage }}
diff --git a/tpl/tplimpl/tplimpl_integration_test.go b/tpl/tplimpl/tplimpl_integration_test.go
index 6b2664c4d..f9d25eb49 100644
--- a/tpl/tplimpl/tplimpl_integration_test.go
+++ b/tpl/tplimpl/tplimpl_integration_test.go
@@ -372,7 +372,7 @@ series: [series-1]
<meta property="og:url" content="/s1/p1/">
<meta property="og:title" content="p1">
<meta property="og:description" content="a b and c can’t.">
- <meta property="og:locale" content="en-US">
+ <meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="article:section" content="s1">
<meta property="article:published_time" content="2024-04-24T08:00:00-07:00">