Skip to content

[DOC-573] Version aliases #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6c6c5c4
add permalinks to main hugo config
Sep 22, 2023
da09239
basic alias versioning working
Sep 22, 2023
ffd9cfa
add netlify redirect test
Sep 22, 2023
77deed3
use _redirects into public for netlify redirect
Sep 22, 2023
3751d22
try sudo chown on public
Sep 22, 2023
667a605
finalize netlify redirects
Sep 22, 2023
c6f8ddb
Merge branch 'main' into DOC-573
dandimeo Sep 22, 2023
0c5ae67
first draft of new alias handling
Sep 26, 2023
ac0a53c
delete netlify redirects
Sep 26, 2023
4e8ff6f
cut _redirects from circleci
Sep 26, 2023
fe36855
fix changeVersion
Sep 26, 2023
f381d8f
Merge branch 'main' into DOC-573
dandimeo Sep 26, 2023
5ae7410
stable as redirect
Sep 26, 2023
493b324
Merge branch 'DOC-573' of github.com:arangodb/docs-hugo into DOC-573
Sep 26, 2023
d82896a
alias header-links
Sep 26, 2023
f6519e5
fix title
Sep 26, 2023
b9ae8c7
add aliases to breadcrumbs and homepage button
Sep 27, 2023
b8637fd
add back to top button
Sep 27, 2023
63f21e5
add 404 call to not found page
Sep 27, 2023
bed838e
use notfound page for real 404
Sep 27, 2023
6c1e747
use notfound.html as real 404 page
Sep 28, 2023
330fa1e
fix 3.8 3.9 redirect issue
Sep 29, 2023
a2106f2
fix setVersionSelector
Sep 29, 2023
4899567
fix: fix not found version
Sep 29, 2023
ac4d358
Merge branch 'main' into DOC-573
dandimeo Sep 29, 2023
7a00d1a
fix: fix anchor links scroll behaviour, put the scroll function call …
dandimeo Sep 29, 2023
f2e822a
Merge branch 'main' into DOC-573
dandimeo Sep 29, 2023
356fb1d
fix: fix introduced bug that didn't redirect to 3.8 3.9 old docs
Sep 29, 2023
aead939
Merge branch 'DOC-573' of github.com:arangodb/docs-hugo into DOC-573
Sep 29, 2023
3c3abb3
[DOC-565] 404 page (#247)
dandimeo Oct 3, 2023
f3a881b
Merge branch 'main' into DOC-573
nerpaula Oct 3, 2023
e7c097c
fix search on page load
Oct 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion site/config/_default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ outputFormats:
baseName: nav
isHTML: true
mediaType: text/html
notfound:
baseName: notfound
isHTML: true
mediaType: text/html

outputs:
home: ["HTML", "navigation"]
home: ["HTML", "navigation", "notfound"]

enableRobotsTXT: true

Expand Down
2 changes: 1 addition & 1 deletion site/data/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

- name: '3.10'
version: "3.10.10"
alias: ""
alias: "3.10"
deprecated: false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 22 additions & 33 deletions site/themes/arangodb-docs-theme/layouts/404.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@

<!DOCTYPE html>
<html lang="{{ .Page.Language | default "en" }}">
<head>
{{- partial "meta.html" . }}
{{- .Scratch.Add "title" "" }}
{{- if eq .Site.Data.titles .Title }}
{{- .Scratch.Set "title" (index .Site.Data.titles .Title).title }}
{{- else }}
{{- .Scratch.Set "title" .Title}}
{{- end }}
<title>{{ .Scratch.Get "title" }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title>

{{- partial "favicon.html" . }}
<head>
{{- partial "stylesheet.html" . }}
<style>
p, li, ul {
text-align: center
}
ul {
list-style-type: none;
}
</style>
{{- partial "meta.html" . }}
<link href="{{ "/images/favicon.png" | relURL }}" rel="icon" type="image/png">
{{- partial "javascript.html" . }}
</head>
<body class="mobile-support" data-url="/">
<div id="body" class="default-animation" style="margin-left:0px;">
<div id="sidebar-overlay"></div>
<main id="body-inner" class="chapter" tabindex="-1">
<div class="flex-block-wrapper">
<h1>{{ T "title-404" }}</h1>
<p></p>
<p>{{ T "message-404" }}</p>
<p></p>
<p><a href="{{ "" | relLangURL }}">{{ T "Go-to-homepage" }}</a></p>
<p><img src="{{ "images/gopher-404.jpg" | relURL }}" style="width:50%" alt="Page not found!"></p>
</div>
</main>
</div>
</body>

<body>
<div id="page-wrapper" class="page_content_splash" style="height: auto;opacity: 0;">
<section id="page-main">
<section class="page-container" id="page-container">
{{ partial "header.html" . }}
<iframe src="/nav.html" title="description" id="menu-iframe" class="menu-iframe active" style="opacity: 0;"></iframe>


<div class="container-main">
<div class="row-main">
</div>
</main><!-- #body-inner -->
</div><!-- #body -->
{{- partial "back-to-top.html" . }}
{{ partial "search.html" . }}
</body>
</html>

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{- range .Site.Sections.ByWeight }}
{{/* version folders */}}
{{- if ne .Type "hooks" }}
<ul class="version-menu {{ .Params.menuTitle }}">{{/* TODO: hide non-stable versions by default? */}}
<ul class="version-menu {{ .Type }} {{ .Store.Get "alias" }}">{{/* TODO: hide non-stable versions by default? */}}
{{- template "section-tree-nav" . }}
</ul>
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<section class="page-container" id="page-container">
<div class="container-main">
<div class="notfound">
<div class="flex-block-wrapper">

<div class="notfound-404">
<p class="notfound-4">4</p>
<img id="notfound-image" src="{{ "images/sad-avocado.png" | relURL }}" alt="Page not found!">
<p class="notfound-4">4</p>
</div>
<hgroup>
<h3 style="text-align: center;">Oops… Avocados are not growing here</h1>
</hgroup>
<p style="text-align: center;">
<a href="{{ site.BaseURL }}/stable">Back to Home</a>
</p>
</div>
</article>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- partial "shortcodes/version.html" (dict "page" .Page ) }}


<!DOCTYPE html>
<html lang='{{ .Page.Language | default "en" }}'>
{{- partial "head.html" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"page" .Page
) }}


<!DOCTYPE html>
<html lang="{{ .Page.Language | default "en" }}">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"page" .Page
) }}


{{- partial "output-partial.hugo" (dict "base" "header" "page" . "parameter" .) }}
{{- if not .File }}
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "initial" "page" . "parameter" .)))) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
<script src="{{"js/featherlight.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>

{{ $versions := index site.Data "versions" }}
<script>
var versions = {{ $versions }}
</script>
{{ range $i, $version := $versions }}
{{ if eq "stable" $version.alias }}
<script>
var stableVersion = {{ $version.name }};
var stableVersion = {{ $version }};
</script>
{{ end }}
{{ if eq "devel" $version.alias }}
<script>
var develVersion = {{ $version.name }};
var develVersion = {{ $version }};
</script>
{{ end }}
{{ end }}


<script src="{{"js/codeblocks.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
2 changes: 1 addition & 1 deletion site/themes/arangodb-docs-theme/layouts/partials/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<meta name="docsearch:version" content="{{ delimit $shortVersions "," }}">
{{- end }}
{{- if or (eq .Type "hooks") (.IsHome) }}
{{- $redirectPath := printf "/%s" (index (where (index site.Data "versions") "alias" "stable") 0).name }}
{{- $redirectPath := printf "/%s" (index (where (index site.Data "versions") "alias" "stable") 0).alias }}
<script>
window.location.href = "{{ $redirectPath }}/";
</script>
Expand Down
5 changes: 0 additions & 5 deletions site/themes/arangodb-docs-theme/layouts/partials/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>

<script type="text/javascript">
// get version from localstorage
var version = localStorage.getItem("docs-version");
var url = new URL(window.location.href);
var versionFromUrl = url.pathname.split("/")[1];
window.setupDocSearch = function (facetVersion) {
docsearch({
appId: "OK3ZBQ5982",
Expand All @@ -21,5 +17,4 @@
},
});
};
window.setupDocSearch(versionFromUrl || version);
</script>
29 changes: 28 additions & 1 deletion site/themes/arangodb-docs-theme/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ img {
opacity: 1;
transition: opacity 0.5s;
height: auto !important;
width: auto !important;
width: auto;
max-height: 100%;
}

Expand Down Expand Up @@ -1260,6 +1260,15 @@ article.default, article.chapter, article.home {
max-width: 800px;
}

article.notfound {
margin: auto;
margin-top: 7rem;
min-height: 600px;
grid-area: article;
width: calc(80vw - 440px);
max-width: 800px;
}

@media screen and (max-width: 768px) {
article.default, article.chapter, article.home {
width: 100vw;
Expand Down Expand Up @@ -2065,6 +2074,24 @@ nav.pagination .next {
margin: 0 !important;
}

/* 404 page */
.flex-block-wrapper {
margin-top: 9rem;
}

.notfound-404 {
display: flex;
font-size: 10rem;
align-items: center;
justify-content: center;
margin-bottom: 4rem;
}

#notfound-image {
display: block;
width: 9rem;
}

.ag-banner {
display: flex;
align-items: center;
Expand Down
Loading