hugo-PaperMod icon indicating copy to clipboard operation
hugo-PaperMod copied to clipboard

schemajson breadcrumb breaks minify when baseURL=/

Open mh-cbon opened this issue 3 years ago • 1 comments
trafficstars

Hi,

When building the site with minify=true and base-url=/ the schema json miss a comma.

This did not happened when base-url has more than 1 slash.

Several tickets were opened around that.

It is at https://github.com/adityatelange/hugo-PaperMod/blob/master/layouts/partials/templates/schema_json.html#L48

A fix is to declare an consume a bool instead of trying to count the number of slash.

like in

  "itemListElement": [
  {{- $zzz := false -}}
  {{- range $index, $element := $bc_list }}
    {{- $zzz = true -}}
...
    {{- end }}

  {{- end }}
  {{- /*  self-page addition  */ -}}
  {{- if $zzz }}, {{end }}

mh-cbon avatar Sep 17 '22 20:09 mh-cbon

+1

FatChicken277 avatar Sep 20 '22 23:09 FatChicken277

baseURL should be properly configured. Avoid setting it as / https://gohugo.io/getting-started/configuration/#baseurl

adityatelange avatar Dec 23 '23 17:12 adityatelange