This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 00433ea  fix: unparsable structured data
00433ea is described below

commit 00433ea96c096dfe19e4c6fd172f1f038deeaf82
Author: Zoran Regvart <zregv...@apache.org>
AuthorDate: Fri Sep 20 20:41:48 2019 +0200

    fix: unparsable structured data
    
    Google search console reported unparsable structured data in JSON-LD
    breadcrumbs. Seems that the multiple invocations of the
    `breadcrumbs-microdata.html` partial lead to identical breadcrumb data
    instances being added to local `"breadcrumb"` scratch. This makes sure
    that the `breadcrumbs-microdata.html` partial uses unique scratch each
    time it's invoked and this should prevent duplicate data.
---
 layouts/partials/seo/structured/breadcrumbs-microdata.html | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/layouts/partials/seo/structured/breadcrumbs-microdata.html 
b/layouts/partials/seo/structured/breadcrumbs-microdata.html
index 43b8115..8d6bafd 100644
--- a/layouts/partials/seo/structured/breadcrumbs-microdata.html
+++ b/layouts/partials/seo/structured/breadcrumbs-microdata.html
@@ -1,12 +1,12 @@
 {{ $url := replace .Permalink .Site.BaseURL "" }}
-{{ $.Scratch.Add "path" .Site.BaseURL }}
-
-{{ $.Scratch.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" 
.Site.Title "position" 1 )) }}
+{{ $local := newScratch }}
+{{ $local.Add "path" .Site.BaseURL }}
+{{ $local.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" .Site.Title 
"position" 1 )) }}
 {{ range $index, $element := split $url "/" }}
-  {{ $.Scratch.Add "path" $element }}
-  {{ $.Scratch.Add "path" "/" }}
+  {{ $local.Add "path" $element }}
+  {{ $local.Add "path" "/" }}
   {{ if ne $element "" }}
-    {{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") 
"name" . "position" (add $index 2))) }}
+    {{ $local.Add "breadcrumb" (slice (dict "url" ($local.Get "path") "name" . 
"position" (add $index 2))) }}
   {{ end }}
 {{ end }}
 
@@ -14,7 +14,7 @@
 {
   "@context": "http://schema.org";,
   "@type": "BreadcrumbList",
-  "itemListElement": [{{ range $.Scratch.Get "breadcrumb" }}{{ if ne .position 
1 }},{{ end }}{
+  "itemListElement": [{{ range $local.Get "breadcrumb" }}{{ if ne .position 1 
}},{{ end }}{
         "@type": "ListItem",
         "position": {{ .position }},
         "item": {

Reply via email to