Skip to content

Commit c52ae2b

Browse files
Merge pull request #1224 from gooddata/snapshot-master-6fdcb364-to-rel/dev
[bot] Merge master/6fdcb364 into rel/dev
2 parents 9ef6730 + 6fdcb36 commit c52ae2b

File tree

4 files changed

+115
-147
lines changed

4 files changed

+115
-147
lines changed

docs/layouts/partials/parseUrlBreadcrumbs.html

Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -15,99 +15,13 @@
1515
{{- $segments := split $pathname "/" -}}
1616
{{- $currentPath := "" -}}
1717

18-
{{- if eq $variant "before-version" -}}
19-
{{/* Variant 1: Return only the base path up to and including /latest/ or any version from Site.Params.versions */}}
20-
{{- $versionFound := false -}}
21-
{{- $versionIndex := 0 -}}
22-
23-
{{- range $index, $segment := $segments -}}
24-
{{- if ne $segment "" -}}
25-
{{/* Check if segment is "latest" */}}
26-
{{- if eq $segment "latest" -}}
27-
{{- $versionFound = true -}}
28-
{{- $versionIndex = $index -}}
29-
{{- else -}}
30-
{{/* Check if segment matches any version in Site.Params.versions or is a semantic version */}}
31-
{{- if and ($.Site.Params) ($.Site.Params.versions) -}}
32-
{{- range $.Site.Params.versions -}}
33-
{{- if eq $segment .version -}}
34-
{{- $versionFound = true -}}
35-
{{- $versionIndex = $index -}}
36-
{{- end -}}
37-
{{- end -}}
38-
{{- else -}}
39-
{{/* Fallback: check if segment looks like a version (1.51, 1.52, etc.) */}}
40-
{{- if or (eq $segment "dev") (eq $segment "master") (findRE `^\d+\.\d+` $segment) -}}
41-
{{- $versionFound = true -}}
42-
{{- $versionIndex = $index -}}
43-
{{- end -}}
44-
{{- end -}}
45-
{{- end -}}
46-
{{- end -}}
47-
{{- end -}}
48-
49-
{{- if $versionFound -}}
50-
{{- $currentPath = "" -}}
51-
{{- range $index, $segment := $segments -}}
52-
{{- if and (le $index $versionIndex) (ne $segment "") -}}
53-
{{- $currentPath = printf "%s%s/" $currentPath $segment -}}
54-
{{- end -}}
55-
{{- end -}}
18+
{{- /* Default variant: Parse all segments */ -}}
19+
{{- range $segments -}}
20+
{{- if ne . "" -}}
21+
{{- $currentPath = printf "%s%s/" $currentPath . -}}
5622
{{- $fullUrl := printf "%s/%s" $host $currentPath -}}
5723
{{- $breadcrumbs = $breadcrumbs | append $fullUrl -}}
5824
{{- end -}}
59-
60-
{{- else if eq $variant "after-version" -}}
61-
{{/* Variant 2: Start parsing from /latest/ or any version from Site.Params.versions */}}
62-
{{- $versionFound := false -}}
63-
{{- $startIndex := 0 -}}
64-
65-
{{- range $index, $segment := $segments -}}
66-
{{- if ne $segment "" -}}
67-
{{/* Check if segment is "latest" */}}
68-
{{- if eq $segment "latest" -}}
69-
{{- $versionFound = true -}}
70-
{{- $startIndex = $index -}}
71-
{{- else -}}
72-
{{/* Check if segment matches any version in Site.Params.versions or is a semantic version */}}
73-
{{- if and ($.Site.Params) ($.Site.Params.versions) -}}
74-
{{- range $.Site.Params.versions -}}
75-
{{- if eq $segment .version -}}
76-
{{- $versionFound = true -}}
77-
{{- $startIndex = $index -}}
78-
{{- end -}}
79-
{{- end -}}
80-
{{- else -}}
81-
{{/* Fallback: check if segment looks like a version (1.51, 1.52, etc.) */}}
82-
{{- if or (eq $segment "dev") (eq $segment "master") (findRE `^\d+\.\d+` $segment) -}}
83-
{{- $versionFound = true -}}
84-
{{- $startIndex = $index -}}
85-
{{- end -}}
86-
{{- end -}}
87-
{{- end -}}
88-
{{- end -}}
89-
{{- end -}}
90-
91-
{{- if $versionFound -}}
92-
{{- $currentPath = "" -}}
93-
{{- range $index, $segment := $segments -}}
94-
{{- if and (ge $index $startIndex) (ne $segment "") -}}
95-
{{- $currentPath = printf "%s%s/" $currentPath $segment -}}
96-
{{- $fullUrl := printf "%s/%s" $host $currentPath -}}
97-
{{- $breadcrumbs = $breadcrumbs | append $fullUrl -}}
98-
{{- end -}}
99-
{{- end -}}
100-
{{- end -}}
101-
102-
{{- else -}}
103-
{{/* Default variant: Parse all segments */}}
104-
{{- range $segments -}}
105-
{{- if ne . "" -}}
106-
{{- $currentPath = printf "%s%s/" $currentPath . -}}
107-
{{- $fullUrl := printf "%s/%s" $host $currentPath -}}
108-
{{- $breadcrumbs = $breadcrumbs | append $fullUrl -}}
109-
{{- end -}}
110-
{{- end -}}
11125
{{- end -}}
11226

11327
{{- if gt (len $breadcrumbs) 0 -}}

docs/layouts/partials/structureddata/structureddata.api-ref.html

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
{{- $pageData := .Page -}}
22
{{- $siteData := .Site -}}
33

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 -}}
96
{{- $breadcrumbs := $breadcrumbsJson | unmarshal -}}
107

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+
1120
{
1221
"@context": "https://schema.org",
1322
"@graph": [
1423
{
1524
"@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/"
1827
},
1928
{
2029
"@type": "Organization",
@@ -24,10 +33,10 @@
2433
},
2534
{
2635
"@type": "TechArticle",
27-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#article",
36+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#article",
2837
"headline": "{{ $pageData.Params.title }} | GoodData Python SDK",
2938
"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 }}",
3140
"dateModified": {{ $pageData.Params.lastmod | jsonify }},
3241
"author": {
3342
"@id": "https://www.gooddata.com/#organization"
@@ -36,10 +45,10 @@
3645
"@id": "https://www.gooddata.com/#organization"
3746
},
3847
"isPartOf": {
39-
"@id": "{{ $basePathVersion }}#website"
48+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#website"
4049
},
4150
"about": {
42-
"@id": "{{ $basePathVersion }}#software"
51+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#software"
4352
},
4453
"articleSection": {{ $pageData.Parent.Title | jsonify }},
4554
"inLanguage": "en",
@@ -52,25 +61,25 @@
5261
"codeRepository": "https://github.com/gooddata/gooddata-python-sdk",
5362
"runtimePlatform": "Python 3.13+",
5463
"targetProduct": {
55-
"@id": "{{ $basePathVersion }}#software"
64+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#software"
5665
}
5766
}
5867
},
5968
{
6069
"@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 }}",
6372
"name": "{{ $pageData.Params.title }} | GoodData Python SDK",
6473
"isPartOf": {
65-
"@id": "{{ $basePathVersion }}#website"
74+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#website"
6675
},
6776
"breadcrumb": {
68-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#breadcrumb"
77+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#breadcrumb"
6978
}
7079
},
7180
{
7281
"@type": "BreadcrumbList",
73-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#breadcrumb",
82+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#breadcrumb",
7483
"itemListElement": [
7584
{
7685
"@type": "ListItem",
@@ -83,15 +92,33 @@
8392
"position": 2,
8493
"name": "Documentation",
8594
"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 }}
87104
{{- $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 }},
89115
{
90116
"@type": "ListItem",
91-
"position": {{ add $index 3 }},
117+
"position": {{ add $index 1 }},
92118
"name": {{ $name | jsonify }},
93-
"item": {{ $breadcrumb | jsonify }}
119+
"item": {{ $latestBreadcrumb | jsonify }}
94120
}{{- end }}
121+
{{- end }}
95122
]
96123
}
97124
]

docs/layouts/partials/structureddata/structureddata.categories.html

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
{{- $pageData := .Page -}}
22
{{- $siteData := .Site -}}
33

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 -}}
96
{{- $breadcrumbs := $breadcrumbsJson | unmarshal -}}
107

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+
1120
{
1221
"@context": "https://schema.org",
1322
"@graph": [
1423
{
1524
"@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/",
1827
},
1928
{
2029
"@type": "Organization",
@@ -24,10 +33,10 @@
2433
},
2534
{
2635
"@type": "TechArticle",
27-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#article",
36+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#article",
2837
"headline": "{{ $pageData.Params.title }} | GoodData Python SDK",
29-
"description":{{ if $pageData.Params.description }}{{ $pageData.Params.description | jsonify }}{{ else }}{{ $pageData.Summary | jsonify }}{{ end }},
30-
"url": "https://www.gooddata.com{{ $pageData.RelPermalink }}",
38+
"description": {{ if $pageData.Params.description }}{{ $pageData.Params.description | jsonify }}{{ else }}{{ $pageData.Summary | jsonify }}{{ end }},
39+
"url": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}",
3140
"dateModified": {{ $pageData.Params.lastmod | jsonify }},
3241
"author": {
3342
"@id": "https://www.gooddata.com/#organization"
@@ -36,29 +45,29 @@
3645
"@id": "https://www.gooddata.com/#organization"
3746
},
3847
"isPartOf": {
39-
"@id": "{{ $basePathVersion }}#website"
48+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#website"
4049
},
4150
"about": {
42-
"@id": "{{ $basePathVersion }}#software"
51+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#software"
4352
},
4453
"articleSection": {{ $pageData.Parent.Title | jsonify }},
4554
"inLanguage": "en"
4655
},
4756
{
4857
"@type": "WebPage",
49-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#webpage",
50-
"url": "https://www.gooddata.com{{ $pageData.RelPermalink }}",
58+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#webpage",
59+
"url": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}",
5160
"name": "{{ $pageData.Params.title }} | GoodData Python SDK",
5261
"isPartOf": {
53-
"@id": "{{ $basePathVersion }}#website"
62+
"@id": "https://www.gooddata.com/docs/python-sdk/latest/#website"
5463
},
5564
"breadcrumb": {
56-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#breadcrumb"
65+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#breadcrumb"
5766
}
5867
},
5968
{
6069
"@type": "BreadcrumbList",
61-
"@id": "https://www.gooddata.com{{ $pageData.RelPermalink }}#breadcrumb",
70+
"@id": "https://www.gooddata.com/docs/python-sdk{{ $latestPath }}#breadcrumb",
6271
"itemListElement": [
6372
{
6473
"@type": "ListItem",
@@ -71,15 +80,33 @@
7180
"position": 2,
7281
"name": "Documentation",
7382
"item": "https://www.gooddata.com/docs/"
74-
}{{- range $index, $breadcrumb := $breadcrumbs }}
83+
},
84+
{
85+
"@type": "ListItem",
86+
"position": 3,
87+
"name": "Python SDK",
88+
"item": "https://www.gooddata.com/docs/python-sdk/latest/"
89+
}
90+
{{- range $index, $breadcrumb := $breadcrumbs }}
91+
{{- if ge $index 3 }}
7592
{{- $segments := split (trim $breadcrumb "/") "/" }}
76-
{{- $name := cond (eq (add $index 3) 3) "Python SDK" (index $segments (sub (len $segments) 1) | humanize) }},
93+
{{- $name := index $segments (sub (len $segments) 1) | humanize }}
94+
{{- $latestBreadcrumb := "" }}
95+
{{- range $seg := $segments }}
96+
{{- if or (eq $seg "latest") (findRE `^\d+\.\d+` $seg) (eq $seg "dev") (eq $seg "master") }}
97+
{{- $latestBreadcrumb = printf "%s/latest" $latestBreadcrumb }}
98+
{{- else if and (ne $seg "") (ne $seg "https:") (ne $seg "www.gooddata.com") }}
99+
{{- $latestBreadcrumb = printf "%s/%s" $latestBreadcrumb $seg }}
100+
{{- end }}
101+
{{- end }}
102+
{{- $latestBreadcrumb = printf "https://www.gooddata.com%s/" $latestBreadcrumb }},
77103
{
78104
"@type": "ListItem",
79-
"position": {{ add $index 3 }},
105+
"position": {{ add $index 1 }},
80106
"name": {{ $name | jsonify }},
81-
"item": {{ $breadcrumb | jsonify }}
107+
"item": {{ $latestBreadcrumb | jsonify }}
82108
}{{- end }}
109+
{{- end }}
83110
]
84111
}
85112
]

0 commit comments

Comments
 (0)