Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions site/themes/arangodb-docs-theme/layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</head>

<body>
<noscript>You need to enable JavaScript to use the ArangoDB documentation.</noscript>
<div id="page-wrapper" class="page_content_splash" style="height: auto;opacity: 0;">
<section id="page-main">
<section class="page-container" id="page-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
{{- $isRemote := ne $url.Scheme "" }}

{{ if $isRemote -}}
{{ $permalink = .Destination -}}
{{ $isProduction := eq site.BaseURL "https://docs.arangodb.com" }}
{{ if and (not $isProduction) (eq .Destination "https://cloud.arangodb.com/home?utm_source=docs&utm_medium=cluster_pages&utm_campaign=docs_traffic") -}}
{{ $permalink = "https://cloud.arangodb.com/home" -}}
{{ else -}}
{{ $permalink = .Destination -}}
{{ end -}}
{{ else -}}
{{ $isOnlyFragment := findRE `(?m)^#` $link }}
{{ if $isOnlyFragment }}
Expand Down
40 changes: 14 additions & 26 deletions site/themes/arangodb-docs-theme/layouts/_default/index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
{{- partial "shortcodes/version.html" (dict "page" .Page ) }}


{{ partial "shortcodes/version.html" (dict "page" .Page) -}}
{{ $isProduction := eq site.BaseURL "https://docs.arangodb.com" -}}
<!DOCTYPE html>
<html lang='{{ .Page.Language | default "en" }}'>
{{- partial "head.html" . }}

<html lang="{{ .Page.Language | default "en" }}">
{{ partial "head.html" . -}}
<body>
<div
id="page-wrapper"
class="page_content_splash"
style="height: auto; opacity: 0"
>
{{ if $isProduction }}{{ partial "tracking/body-start.html" . }}{{ end -}}
<noscript>You need to enable JavaScript to use the ArangoDB documentation.</noscript>
<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>

{{ 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">
{{ partial "breadcrumbs.html" . }} {{- partial
"output-partial.hugo" (dict "base" "body" "page" . "parameter"
(dict "page" . "content" (partial "output-partial.hugo" (dict
"base" "content" "page" . "parameter" .)))) }} {{ partial
"toc.html" . }}
{{ partial "breadcrumbs.html" . -}}
{{ partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) }}
{{ partial "toc.html" . -}}
</div>
</div>
</section>
</section>
</div>
{{ partial "search.html" . }}
{{ partial "search.html" . -}}
{{ if $isProduction }}{{ partial "tracking/body-end.html" . }}{{ end -}}
</body>
</html>
51 changes: 25 additions & 26 deletions site/themes/arangodb-docs-theme/layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{{- partial "shortcodes/version.html" (dict
"page" .Page
) }}
{{- partial "shortcodes/version.html" (dict "page" .Page) -}}
{{ $isProduction := eq site.BaseURL "https://docs.arangodb.com" -}}

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

{{- partial "head.html" . }}

<body>
{{ partial "head.html" . -}}
<body>
{{ if $isProduction }}{{ partial "tracking/body-start.html" . }}{{ end -}}
<noscript>You need to enable JavaScript to use the ArangoDB documentation.</noscript>
<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">
{{ if gt (len .Page.Ancestors) 1 }}{{ partial "breadcrumbs.html" . }}{{ end }}
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) }}
{{ partial "toc.html" . }}
</div>
</main><!-- #body-inner -->
</div><!-- #body -->
{{- partialCached "back-to-top.html" . }}
{{ partial "search.html" . }}
</body>

</html>
<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">
{{ if gt (len .Page.Ancestors) 1 }}{{ partial "breadcrumbs.html" . }}{{ end -}}
{{ partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) -}}
{{ partial "toc.html" . -}}
</div>
</div>
</section>
</section>
</div>
{{ partialCached "back-to-top.html" . -}}
{{ partial "search.html" . -}}
{{ if $isProduction }}{{ partial "tracking/body-end.html" . }}{{ end -}}
</body>
</html>
51 changes: 25 additions & 26 deletions site/themes/arangodb-docs-theme/layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{{- partial "shortcodes/version.html" (dict
"page" .Page
) }}

{{ partial "shortcodes/version.html" (dict "page" .Page) -}}
{{ $isProduction := eq site.BaseURL "https://docs.arangodb.com" -}}

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

{{- partial "head.html" . }}

<body>
{{ partial "head.html" . -}}
<body>
{{ if $isProduction }}{{ partial "tracking/body-start.html" . }}{{ end -}}
<noscript>You need to enable JavaScript to use the ArangoDB documentation.</noscript>
<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">
{{ partial "breadcrumbs.html" . }}
{{- partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) }}
{{ partial "toc.html" . }}
</div>
</main><!-- #body-inner -->
</div><!-- #body -->
{{- partial "back-to-top.html" . }}
{{ partial "search.html" . }}
</body>
</html>
<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">
{{ partial "breadcrumbs.html" . -}}
{{ partial "output-partial.hugo" (dict "base" "body" "page" . "parameter" (dict "page" . "content" (partial "output-partial.hugo" (dict "base" "content" "page" . "parameter" .)))) -}}
{{ partial "toc.html" . -}}
</div>
</div>
</section>
</section>
</div>
{{ partialCached "back-to-top.html" . -}}
{{ partial "search.html" . -}}
{{ if $isProduction }}{{ partial "tracking/body-end.html" . }}{{ end -}}
</body>
</html>
23 changes: 14 additions & 9 deletions site/themes/arangodb-docs-theme/layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<head>
{{- partial "stylesheet.html" . }}
{{ partial "stylesheet.html" . -}}

{{- partial "meta.html" . }}
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
<title>{{ if and .Title (not (eq .Title .Site.Title)) }}{{ .Title | markdownify | plainify | safeHTML }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Site.Title }}</title>
{{ partial "meta.html" . -}}
<title>{{ if and .Title (not (eq .Title .Site.Title)) }}{{ .Title | markdownify | plainify | safeHTML }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Site.Title }}</title>
<link href="{{ "/images/favicon.png" | relURL }}" rel="icon" type="image/png">
{{ partial "javascript.html" . -}}

<link href="{{ "/images/favicon.png" | relURL }}" rel="icon" type="image/png">
{{- partial "javascript.html" . }}


</head>
{{ $isProduction := eq site.BaseURL "https://docs.arangodb.com" -}}
{{ if $isProduction -}}
{{- partial "tracking/gtag.html" . -}}
{{- partial "tracking/gtm.html" . -}}
{{- partial "tracking/ga.html" . -}}
{{- partial "tracking/twitter.html" . -}}
{{- partial "tracking/linkedin.html" . -}}
{{ end -}}
</head>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script id="hs-script-loader" async defer src="//js.hs-scripts.com/2482448.js"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5LQ7HC" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<noscript><img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=499017&fmt=gif"></noscript>
22 changes: 22 additions & 0 deletions site/themes/arangodb-docs-theme/layouts/partials/tracking/ga.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('provide', 'adblockTracker', function(tracker, opts) {
var ad = document.createElement('ins');
ad.className = 'AdSense';
ad.style.display = 'block';
ad.style.position = 'absolute';
ad.style.top = '-1px';
ad.style.height = '1px';
document.body.appendChild(ad);
tracker.set('dimension' + opts.dimensionIndex, !ad.clientHeight);
document.body.removeChild(ad);
});

ga('create', 'UA-81053435-6', 'auto');
ga('require', 'adblockTracker', {dimensionIndex: 1});
ga('send', 'pageview');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-81053435-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-81053435-1');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5LQ7HC');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
_linkedin_partner_id = "499017";
window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
window._linkedin_data_partner_ids.push(_linkedin_partner_id);
</script>
<script>
(function(){var s = document.getElementsByTagName("script")[0];
var b = document.createElement("script");
b.type = "text/javascript";b.async = true;
b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
s.parentNode.insertBefore(b, s);})();
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
twq('init','nz793');
twq('track','PageView');
</script>
45 changes: 23 additions & 22 deletions site/themes/arangodb-docs-theme/static/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function menuEntryClickListener() {
return
}
console.log(event.target)
updateHistory("", event.target.getAttribute('href'))
updateHistory(event.target.getAttribute('href'))
$('#sidebar.mobile').removeClass("active")

});
Expand Down Expand Up @@ -109,17 +109,15 @@ function replaceArticle(href, newDoc) {
}


function updateHistory(title, url) {
console.log("Update History " + url)
if (url == window.location.href) {
function updateHistory(urlPath) {
console.log("Update History " + urlPath)
if (urlPath == window.location.pathname + window.location.hash) {
return
}

window.history.pushState("navchange", "ArangoDB Documentation", url);
window.history.pushState("navchange", "ArangoDB Documentation", urlPath);
if (!urlPath.startsWith("#")) trackPageView(document.title, urlPath);

var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', url]);
_hsq.push(['trackPageView']);
var popStateEvent = new PopStateEvent('popstate', { state: "navchange" });
dispatchEvent(popStateEvent);
}
Expand Down Expand Up @@ -181,7 +179,7 @@ function internalLinkListener() {
return;
}
event.preventDefault();
updateHistory("", event.target.getAttribute('href'))
updateHistory(event.target.getAttribute('href'))
})
}

Expand All @@ -193,7 +191,18 @@ function codeShowMoreListener() {
})
}

function trackPageView(title, urlPath) {
if (window.gtag) {
gtag('config', 'UA-81053435-1', {
'page_title': title,
'page_path': urlPath
});
}

var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', urlPath]);
_hsq.push(['trackPageView']);
}

function initArticle(url) {
restoreTabSelections();
Expand All @@ -220,11 +229,6 @@ $(window).on('popstate', function (e) {

$(window).on('hashchange', function (e) {
window.history.pushState("popstate", "ArangoDB Documentation", window.location.href);

var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', window.location.href]);
_hsq.push(['trackPageView']);

scrollToFragment()
});

Expand Down Expand Up @@ -419,9 +423,9 @@ function changeVersion() {
}


var newUrl = window.location.href.replace(getVersionByURL(), getVersionInfo(newVersion).alias)
var newUrl = window.location.pathname.replace(getVersionByURL(), getVersionInfo(newVersion).alias) + window.location.hash;
console.log("Change Version URL " + newUrl)
updateHistory("", newUrl);
updateHistory(newUrl);
}


Expand Down Expand Up @@ -517,8 +521,8 @@ const goToTop = (event) => {

function goToHomepage(event){
event.preventDefault();
var homepage = window.location.origin + "/" + getVersionByURL() + "/";
updateHistory("", homepage);
var homepage = "/" + getVersionByURL() + "/";
updateHistory(homepage);
}

function copyURI(evt) {
Expand All @@ -544,10 +548,7 @@ function toggleExpandShortcode(event) {

window.onload = () => {
window.history.pushState("popstate", "ArangoDB Documentation", window.location.href);

var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', window.location.href]);
_hsq.push(['trackPageView']);
trackPageView(document.title, window.location.pathname);

var iframe = document.getElementById('menu-iframe');
var iFrameBody = iframe.contentDocument || iframe.contentWindow.document;
Expand Down