Skip to content

Commit 26dce2f

Browse files
dandimeodandimeonerpaula
authored
[DOC-573] Version aliases (#232)
* add permalinks to main hugo config * basic alias versioning working * add netlify redirect test * use _redirects into public for netlify redirect * try sudo chown on public * finalize netlify redirects * first draft of new alias handling * delete netlify redirects * cut _redirects from circleci * fix changeVersion * stable as redirect * alias header-links * fix title * add aliases to breadcrumbs and homepage button * add back to top button * add 404 call to not found page * use notfound page for real 404 * use notfound.html as real 404 page * fix 3.8 3.9 redirect issue * fix setVersionSelector * fix: fix not found version * fix: fix anchor links scroll behaviour, put the scroll function call in loadPage() and delete debug warnf page (#251) Co-authored-by: dandimeo <daniele@arangodb.com> * fix: fix introduced bug that didn't redirect to 3.8 3.9 old docs * [DOC-565] 404 page (#247) * first 404 implemenetaiton * fix: add missing / at homepage redirect * finish not found implementation * get rid of page-loading system in 404.html --------- Co-authored-by: dandimeo <daniele@arangodb.com> * fix search on page load --------- Co-authored-by: dandimeo <daniele@arangodb.com> Co-authored-by: Paula Mihu <97217318+nerpaula@users.noreply.github.com>
1 parent 428584f commit 26dce2f

File tree

17 files changed

+191
-106
lines changed

17 files changed

+191
-106
lines changed

site/config/_default/config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ outputFormats:
3232
baseName: nav
3333
isHTML: true
3434
mediaType: text/html
35+
notfound:
36+
baseName: notfound
37+
isHTML: true
38+
mediaType: text/html
3539

3640
outputs:
37-
home: ["HTML", "navigation"]
41+
home: ["HTML", "navigation", "notfound"]
3842

3943
enableRobotsTXT: true
4044

site/data/versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
- name: '3.10'
1212
version: "3.10.10"
13-
alias: ""
13+
alias: "3.10"
1414
deprecated: false
Loading
Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1+
12
<!DOCTYPE html>
23
<html lang="{{ .Page.Language | default "en" }}">
3-
<head>
4-
{{- partial "meta.html" . }}
5-
{{- .Scratch.Add "title" "" }}
6-
{{- if eq .Site.Data.titles .Title }}
7-
{{- .Scratch.Set "title" (index .Site.Data.titles .Title).title }}
8-
{{- else }}
9-
{{- .Scratch.Set "title" .Title}}
10-
{{- end }}
11-
<title>{{ .Scratch.Get "title" }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title>
124

13-
{{- partial "favicon.html" . }}
5+
<head>
146
{{- partial "stylesheet.html" . }}
15-
<style>
16-
p, li, ul {
17-
text-align: center
18-
}
19-
ul {
20-
list-style-type: none;
21-
}
22-
</style>
7+
{{- partial "meta.html" . }}
8+
<link href="{{ "/images/favicon.png" | relURL }}" rel="icon" type="image/png">
9+
{{- partial "javascript.html" . }}
2310
</head>
24-
<body class="mobile-support" data-url="/">
25-
<div id="body" class="default-animation" style="margin-left:0px;">
26-
<div id="sidebar-overlay"></div>
27-
<main id="body-inner" class="chapter" tabindex="-1">
28-
<div class="flex-block-wrapper">
29-
<h1>{{ T "title-404" }}</h1>
30-
<p></p>
31-
<p>{{ T "message-404" }}</p>
32-
<p></p>
33-
<p><a href="{{ "" | relLangURL }}">{{ T "Go-to-homepage" }}</a></p>
34-
<p><img src="{{ "images/gopher-404.jpg" | relURL }}" style="width:50%" alt="Page not found!"></p>
35-
</div>
36-
</main>
37-
</div>
38-
</body>
11+
12+
<body>
13+
<div id="page-wrapper" class="page_content_splash" style="height: auto;opacity: 0;">
14+
<section id="page-main">
15+
<section class="page-container" id="page-container">
16+
{{ partial "header.html" . }}
17+
<iframe src="/nav.html" title="description" id="menu-iframe" class="menu-iframe active" style="opacity: 0;"></iframe>
18+
19+
20+
<div class="container-main">
21+
<div class="row-main">
22+
</div>
23+
</main><!-- #body-inner -->
24+
</div><!-- #body -->
25+
{{- partial "back-to-top.html" . }}
26+
{{ partial "search.html" . }}
27+
</body>
3928
</html>

site/themes/arangodb-docs-theme/layouts/_default/home.index_310.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

site/themes/arangodb-docs-theme/layouts/_default/home.index_311.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

site/themes/arangodb-docs-theme/layouts/_default/home.index_312.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

site/themes/arangodb-docs-theme/layouts/_default/home.navigation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{- range .Site.Sections.ByWeight }}
77
{{/* version folders */}}
88
{{- if ne .Type "hooks" }}
9-
<ul class="version-menu {{ .Params.menuTitle }}">{{/* TODO: hide non-stable versions by default? */}}
9+
<ul class="version-menu {{ .Type }} {{ .Store.Get "alias" }}">{{/* TODO: hide non-stable versions by default? */}}
1010
{{- template "section-tree-nav" . }}
1111
</ul>
1212
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<section class="page-container" id="page-container">
2+
<div class="container-main">
3+
<div class="notfound">
4+
<div class="flex-block-wrapper">
5+
6+
<div class="notfound-404">
7+
<p class="notfound-4">4</p>
8+
<img id="notfound-image" src="{{ "images/sad-avocado.png" | relURL }}" alt="Page not found!">
9+
<p class="notfound-4">4</p>
10+
</div>
11+
<hgroup>
12+
<h3 style="text-align: center;">Oops… Avocados are not growing here</h1>
13+
</hgroup>
14+
<p style="text-align: center;">
15+
<a href="{{ site.BaseURL }}/stable">Back to Home</a>
16+
</p>
17+
</div>
18+
</article>
19+
</div>
20+
</section>

site/themes/arangodb-docs-theme/layouts/_default/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{- partial "shortcodes/version.html" (dict "page" .Page ) }}
22

3+
34
<!DOCTYPE html>
45
<html lang='{{ .Page.Language | default "en" }}'>
56
{{- partial "head.html" . }}

site/themes/arangodb-docs-theme/layouts/_default/single.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"page" .Page
33
) }}
44

5+
56
<!DOCTYPE html>
67
<html lang="{{ .Page.Language | default "en" }}">
78

site/themes/arangodb-docs-theme/layouts/partials/_main.hugo

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"page" .Page
33
) }}
44

5-
65
{{- partial "output-partial.hugo" (dict "base" "header" "page" . "parameter" .) }}
76
{{- if not .File }}
87
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "initial" "page" . "parameter" .)))) }}

site/themes/arangodb-docs-theme/layouts/partials/javascript.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@
33
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
44

55
{{ $versions := index site.Data "versions" }}
6+
<script>
7+
var versions = {{ $versions }}
8+
</script>
69
{{ range $i, $version := $versions }}
710
{{ if eq "stable" $version.alias }}
811
<script>
9-
var stableVersion = {{ $version.name }};
12+
var stableVersion = {{ $version }};
1013
</script>
1114
{{ end }}
1215
{{ if eq "devel" $version.alias }}
1316
<script>
14-
var develVersion = {{ $version.name }};
17+
var develVersion = {{ $version }};
1518
</script>
1619
{{ end }}
1720
{{ end }}
1821

19-
2022
<script src="{{"js/codeblocks.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
2123
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>

site/themes/arangodb-docs-theme/layouts/partials/meta.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<meta name="docsearch:version" content="{{ delimit $shortVersions "," }}">
2727
{{- end }}
2828
{{- if or (eq .Type "hooks") (.IsHome) }}
29-
{{- $redirectPath := printf "/%s" (index (where (index site.Data "versions") "alias" "stable") 0).name }}
29+
{{- $redirectPath := printf "/%s" (index (where (index site.Data "versions") "alias" "stable") 0).alias }}
3030
<script>
3131
window.location.href = "{{ $redirectPath }}/";
3232
</script>

site/themes/arangodb-docs-theme/layouts/partials/search.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
44

55
<script type="text/javascript">
6-
// get version from localstorage
7-
var version = localStorage.getItem("docs-version");
8-
var url = new URL(window.location.href);
9-
var versionFromUrl = url.pathname.split("/")[1];
106
window.setupDocSearch = function (facetVersion) {
117
docsearch({
128
appId: "OK3ZBQ5982",
@@ -21,5 +17,4 @@
2117
},
2218
});
2319
};
24-
window.setupDocSearch(versionFromUrl || version);
2520
</script>

site/themes/arangodb-docs-theme/static/css/theme.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ img {
258258
opacity: 1;
259259
transition: opacity 0.5s;
260260
height: auto !important;
261-
width: auto !important;
261+
width: auto;
262262
max-height: 100%;
263263
}
264264

@@ -1260,6 +1260,15 @@ article.default, article.chapter, article.home {
12601260
max-width: 800px;
12611261
}
12621262

1263+
article.notfound {
1264+
margin: auto;
1265+
margin-top: 7rem;
1266+
min-height: 600px;
1267+
grid-area: article;
1268+
width: calc(80vw - 440px);
1269+
max-width: 800px;
1270+
}
1271+
12631272
@media screen and (max-width: 768px) {
12641273
article.default, article.chapter, article.home {
12651274
width: 100vw;
@@ -2065,6 +2074,24 @@ nav.pagination .next {
20652074
margin: 0 !important;
20662075
}
20672076

2077+
/* 404 page */
2078+
.flex-block-wrapper {
2079+
margin-top: 9rem;
2080+
}
2081+
2082+
.notfound-404 {
2083+
display: flex;
2084+
font-size: 10rem;
2085+
align-items: center;
2086+
justify-content: center;
2087+
margin-bottom: 4rem;
2088+
}
2089+
2090+
#notfound-image {
2091+
display: block;
2092+
width: 9rem;
2093+
}
2094+
20682095
.ag-banner {
20692096
display: flex;
20702097
align-items: center;

0 commit comments

Comments
 (0)