Skip to content

Commit

Permalink
Redirection template added
Browse files Browse the repository at this point in the history
  • Loading branch information
pdavide committed Mar 28, 2019
1 parent 187ef91 commit bf52102
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions redirect.yml
@@ -0,0 +1,4 @@
domain: docs.italia.it
publisher: italia
publisher_project: developers-italia
document_repository: lg-acquisizione-e-riuso-software-per-pa-docs
27 changes: 27 additions & 0 deletions redirect_template/layout.html
@@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>{{ docstitle }}</title>
</head>
<body>
If you are not redirected automatically, follow <a id="redirect">this link</a>.
</body>
<script>
var document_url = window.location.href.match(/\/\/[^\/]*\/([^\/]*)\/([^\/]*)\/(.*)/);
var language = document_url[1];
var version = document_url[2].replace('latest', 'bozza').replace('stable', 'stabile');
var document_page = document_url[3];
var redirect_url = [
'https://{{ domain }}',
'{{ publisher }}',
'{{ publisher_project }}',
'{{ document_repository }}',
language,
version,
document_page
].join('/');
window.location.href = redirect_url;
document.getElementById('redirect').href = redirect_url;
</script>
</html>
2 changes: 2 additions & 0 deletions redirect_template/theme.conf
@@ -0,0 +1,2 @@
[theme]
inherit = basic

0 comments on commit bf52102

Please sign in to comment.