Skip to content

Commit 93bc5ac

Browse files
committed
Fix and refactor breadcrumbs
Make long version numbers for core work and switch from Microdata to RDFa
1 parent c39f6de commit 93bc5ac

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed
Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
11
<nav class="breadcrumbs">
2-
<ol class="links" itemscope itemtype="http://schema.org/BreadcrumbList">
3-
<meta itemprop="itemListOrder" content="Descending" />
4-
{{ range .Ancestors.Reverse -}}
2+
<ol class="links" vocab="http://schema.org/" typeof="BreadcrumbList">
3+
{{ $position := 0 -}}
4+
{{ range .Ancestors.Reverse | append . -}}
55
{{ if not .IsHome -}}
6-
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
7-
<meta itemprop="position" content="{{ .Params.menuTitle | markdownify }}" />
8-
<a itemprop="item" class="link" href="{{ .RelPermalink }}">
9-
<span itemprop="name" class="breadcrumb-entry">
10-
{{ if eq .Path "/arangodb/" -}}
11-
{{ $coreVersion := index (split .Path "/") 2 }}
12-
{{ template "getVersionLong" dict "coreVersion" $coreVersion -}}
13-
{{ else -}}
14-
{{ .Params.menuTitle | markdownify -}}
15-
{{ end -}}
16-
</span>
17-
</a>
18-
<i class="fas fa-chevron-right fa-fw"></i>
19-
</li>
6+
{{ $position = add $position 1 -}}
7+
<li typeof="ListItem" property="itemListElement">
8+
<meta property="position" content="{{ $position }}" />
9+
{{ if gt $position 1 }}<i class="fas fa-chevron-right fa-fw"></i>{{/* TODO <svg style="height: 12px; width: 12px" viewBox="0 0 7 7"><path fill="none" stroke="currentColor" stroke-width="1" d="m 2,6.5 3,-3 -3,-3"></path></svg> */}}{{ end -}}
10+
<a property="item" class="link" href="{{ .RelPermalink }}">{{/* White-space control */ -}}
11+
<span property="name" class="breadcrumb-entry">
12+
{{- $splitPath := split .Path "/" -}}
13+
{{ if and (hasPrefix .Path "/arangodb/") (eq ($splitPath | len) 3) -}}
14+
{{ $coreVersion := index $splitPath 2 -}}
15+
{{ template "getVersionLong" dict "coreVersion" $coreVersion -}}
16+
{{ else -}}
17+
{{ .Params.menuTitle | markdownify -}}
18+
{{ end -}}
19+
</span>
20+
</a>
21+
</li>
2022
{{ end -}}
21-
{{ end -}}
22-
{{ if not .IsHome -}}
23-
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
24-
<meta itemprop="position" content="{{ .Params.menuTitle | markdownify }}" />
25-
<a itemprop="item" class="link" href="{{ .RelPermalink }}">
26-
<span itemprop="name" class="breadcrumb-entry">
27-
{{ if eq .Path "/arangodb/" -}}
28-
{{ $coreVersion := index (split .Path "/") 2 }}
29-
{{ template "getVersionLong" dict "coreVersion" $coreVersion -}}
30-
{{ else -}}
31-
{{ .Params.menuTitle | markdownify -}}
32-
{{ end -}}
33-
</span>
34-
</a>
35-
</li>
3623
{{ end -}}
3724
</ol>
3825
</nav>
@@ -41,8 +28,9 @@
4128
{{ $coreVersion := .coreVersion -}}
4229
{{ $versions := index site.Data.versions "/arangodb/" -}}
4330
{{ range $i, $version := $versions -}}
44-
{{ if eq $coreVersion $version.name -}}
31+
{{ if or (eq $coreVersion $version.name) (eq $coreVersion $version.alias) -}}
4532
{{ $version.version -}}
33+
{{ break -}}
4634
{{ end -}}
4735
{{ end -}}
4836
{{ end -}}

0 commit comments

Comments
 (0)