|
1 | 1 | {{- $pageData := .Page -}} |
2 | 2 | {{- $siteData := .Site -}} |
3 | 3 |
|
4 | | -{{- $pageUrl := printf "https://www.gooddata.com%s" $pageData.RelPermalink -}} |
5 | | -{{- $basePathVersionJson := partial "parseUrlBreadcrumbs.html" (dict "url" $pageUrl "variant" "before-version") -}} |
6 | | -{{- $basePathVersionArray := $basePathVersionJson | unmarshal -}} |
7 | | -{{- $basePathVersion := cond (gt (len $basePathVersionArray) 0) (index $basePathVersionArray 0) "https://www.gooddata.com/docs/python-sdk/latest/" -}} |
8 | | -{{- $breadcrumbsJson := partial "parseUrlBreadcrumbs.html" (dict "url" $pageUrl "variant" "after-version") -}} |
| 4 | +{{- $pageUrl := printf "https://www.gooddata.com/docs/python-sdk%s" $pageData.RelPermalink -}} |
| 5 | +{{- $breadcrumbsJson := partial "parseUrlBreadcrumbs.html" $pageUrl -}} |
9 | 6 | {{- $breadcrumbs := $breadcrumbsJson | unmarshal -}} |
10 | 7 |
|
| 8 | +{{- /* Build path with /latest/ instead of version */ -}} |
| 9 | +{{- $pathSegments := split (trim $pageData.RelPermalink "/") "/" -}} |
| 10 | +{{- $latestPath := "" -}} |
| 11 | +{{- range $seg := $pathSegments -}} |
| 12 | + {{- if or (eq $seg "latest") (findRE `^\d+\.\d+` $seg) (eq $seg "dev") (eq $seg "master") -}} |
| 13 | + {{- $latestPath = printf "%s/latest" $latestPath -}} |
| 14 | + {{- else -}} |
| 15 | + {{- $latestPath = printf "%s/%s" $latestPath $seg -}} |
| 16 | + {{- end -}} |
| 17 | +{{- end -}} |
| 18 | +{{- $latestPath = printf "%s/" $latestPath -}} |
| 19 | + |
11 | 20 | { |
12 | 21 | "@context": "https://schema.org", |
13 | 22 | "@graph": [ |
14 | 23 | { |
15 | 24 | "@type": "WebSite", |
16 | | - "@id": "{{ $basePathVersion }}#website", |
17 | | - "url": {{ $basePathVersion | jsonify }} |
| 25 | + "@id": "https://www.gooddata.com/docs/python-sdk/latest/#website", |
| 26 | + "url": "https://www.gooddata.com/docs/python-sdk/latest/" |
18 | 27 | }, |
19 | 28 | { |
20 | 29 | "@type": "Organization", |
|
24 | 33 | }, |
25 | 34 | { |
26 | 35 | "@type": "TechArticle", |
27 | | - "@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#article", |
| 36 | + "@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#article", |
28 | 37 | "headline": "{{ $pageData.Params.title }} | GoodData Python SDK", |
29 | 38 | "description": {{ if $pageData.Params.description }}{{ $pageData.Params.description | jsonify }}{{ else }}{{ $pageData.Summary | jsonify }}{{ end }}, |
30 | | - "url": "https://www.gooddata.com{{ $pageData.RelPermalink }}", |
| 39 | + "url": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}", |
31 | 40 | "dateModified": {{ $pageData.Params.lastmod | jsonify }}, |
32 | 41 | "author": { |
33 | 42 | "@id": "https://www.gooddata.com/#organization" |
|
36 | 45 | "@id": "https://www.gooddata.com/#organization" |
37 | 46 | }, |
38 | 47 | "isPartOf": { |
39 | | - "@id": "{{ $basePathVersion }}#website" |
| 48 | + "@id": "https://www.gooddata.com/docs/python-sdk/latest/#website" |
40 | 49 | }, |
41 | 50 | "about": { |
42 | | - "@id": "{{ $basePathVersion }}#software" |
| 51 | + "@id": "https://www.gooddata.com/docs/python-sdk/latest/#software" |
43 | 52 | }, |
44 | 53 | "articleSection": {{ $pageData.Parent.Title | jsonify }}, |
45 | 54 | "inLanguage": "en", |
|
52 | 61 | "codeRepository": "https://github.com/gooddata/gooddata-python-sdk", |
53 | 62 | "runtimePlatform": "Python 3.13+", |
54 | 63 | "targetProduct": { |
55 | | - "@id": "{{ $basePathVersion }}#software" |
| 64 | + "@id": "https://www.gooddata.com/docs/python-sdk/latest/#software" |
56 | 65 | } |
57 | 66 | } |
58 | 67 | }, |
59 | 68 | { |
60 | 69 | "@type": "WebPage", |
61 | | - "@id": "https://www.gooddata.com/docs/python-sdk/latest/administration/organization/update_name/#webpage", |
62 | | - "url": "https://www.gooddata.com/docs/python-sdk/latest/administration/organization/update_name/", |
| 70 | + "@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#webpage", |
| 71 | + "url": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}", |
63 | 72 | "name": "{{ $pageData.Params.title }} | GoodData Python SDK", |
64 | 73 | "isPartOf": { |
65 | | - "@id": "{{ $basePathVersion }}#website" |
| 74 | + "@id": "https://www.gooddata.com/docs/python-sdk/latest/#website" |
66 | 75 | }, |
67 | 76 | "breadcrumb": { |
68 | | - "@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#breadcrumb" |
| 77 | + "@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#breadcrumb" |
69 | 78 | } |
70 | 79 | }, |
71 | 80 | { |
72 | 81 | "@type": "BreadcrumbList", |
73 | | - "@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#breadcrumb", |
| 82 | + "@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#breadcrumb", |
74 | 83 | "itemListElement": [ |
75 | 84 | { |
76 | 85 | "@type": "ListItem", |
|
83 | 92 | "position": 2, |
84 | 93 | "name": "Documentation", |
85 | 94 | "item": "https://www.gooddata.com/docs/" |
86 | | - }{{- range $index, $breadcrumb := $breadcrumbs }} |
| 95 | + }, |
| 96 | + { |
| 97 | + "@type": "ListItem", |
| 98 | + "position": 3, |
| 99 | + "name": "Python SDK", |
| 100 | + "item": "https://www.gooddata.com/docs/python-sdk/latest/" |
| 101 | + } |
| 102 | + {{- range $index, $breadcrumb := $breadcrumbs }} |
| 103 | + {{- if ge $index 3 }} |
87 | 104 | {{- $segments := split (trim $breadcrumb "/") "/" }} |
88 | | - {{- $name := cond (eq (add $index 3) 3) "Python SDK" (index $segments (sub (len $segments) 1) | humanize) }}, |
| 105 | + {{- $name := index $segments (sub (len $segments) 1) | humanize }} |
| 106 | + {{- $latestBreadcrumb := "" }} |
| 107 | + {{- range $seg := $segments }} |
| 108 | + {{- if or (eq $seg "latest") (findRE `^\d+\.\d+` $seg) (eq $seg "dev") (eq $seg "master") }} |
| 109 | + {{- $latestBreadcrumb = printf "%s/latest" $latestBreadcrumb }} |
| 110 | + {{- else if and (ne $seg "") (ne $seg "https:") (ne $seg "www.gooddata.com") }} |
| 111 | + {{- $latestBreadcrumb = printf "%s/%s" $latestBreadcrumb $seg }} |
| 112 | + {{- end }} |
| 113 | + {{- end }} |
| 114 | + {{- $latestBreadcrumb = printf "https://www.gooddata.com%s/" $latestBreadcrumb }}, |
89 | 115 | { |
90 | 116 | "@type": "ListItem", |
91 | | - "position": {{ add $index 3 }}, |
| 117 | + "position": {{ add $index 1 }}, |
92 | 118 | "name": {{ $name | jsonify }}, |
93 | | - "item": {{ $breadcrumb | jsonify }} |
| 119 | + "item": {{ $latestBreadcrumb | jsonify }} |
94 | 120 | }{{- end }} |
| 121 | + {{- end }} |
95 | 122 | ] |
96 | 123 | } |
97 | 124 | ] |
|
0 commit comments