zregvart commented on a change in pull request #69: new: breadcrumbs.html
URL: https://github.com/apache/camel-website/pull/69#discussion_r312363453
 
 

 ##########
 File path: layouts/partials/breadcrumbs.html
 ##########
 @@ -0,0 +1,26 @@
+{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
+{{ $.Scratch.Add "path" .Site.BaseURL }}
+
+{{ $.Scratch.Add "breadcrumb" (slice (dict "url" .Site.BaseURL "name" "home" 
"position" 1 )) }}
+{{ range $index, $element := split $url "/" }}
+{{ $.Scratch.Add "path" $element }}
+{{ $.Scratch.Add "path" "/" }}
+{{ if ne $element "" }}
+{{ $.Scratch.Add "breadcrumb" (slice (dict "url" ($.Scratch.Get "path") "name" 
. "position" (add $index 2))) }}
+{{ end }}
+{{ end }}
+
+<script type="application/ld+json">
+{
+  "@context": "http://schema.org";,
+  "@type": "BreadcrumbList",
+  "itemListElement": [{{ range $.Scratch.Get "breadcrumb" }}{{ if ne .position 
1 }},{{ end }}{
+        "@type": "ListItem",
+        "position": {{ .position }},
+        "item": {
+          "@id": "{{ .url }}",
 
 Review comment:
   ```suggestion
             "@id": {{ .url }},
   ```
   
   We need to remove quotes here, otherwise the output has backslash-escaped 
value for `@id`:
   ```html
   <script type="application/ld+json">
   {
       "@context":"http://schema.org";,
       "@type":"BreadcrumbList",
       "itemListElement":[ {
           "@type":"ListItem",
           "position":1,
           "item": {
               "@id": "https:\/\/camel.apache.org\/",
               "name": "home"
           }
       },
       {
           "@type":"ListItem",
           "position":2,
           "item": {
               "@id": "https:\/\/camel.apache.org\/community\/",
               "name": "community"
           }
       },
       {
           "@type":"ListItem",
           "position":3,
           "item": {
               "@id": "https:\/\/camel.apache.org\/community\/support\/",
               "name": "support"
           }
       } ]
   }
   </script>
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to