Skip to content

Commit

Permalink
Merge pull request #207 from amadeus4dev/redirecterror
Browse files Browse the repository at this point in the history
Test to see if URL to main portal works
  • Loading branch information
minjikarin authored Dec 15, 2023
2 parents e35a851 + 69d1bef commit cf1b06b
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions overrides/main.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
{#-
This file was automatically generated - do not edit
-#}
This file was automatically generated - do not edit
-#}

{% extends "base.html" %}
{% block extrahead %}
<script>
if (window.location.hostname === 'amadeus4dev.github.io') {
console.log(window.location.hostname);
const path = window.location.pathname;
const redirectPattern = /^\/([^/]+)/;
const redirectUrl = path.replace(redirectPattern, 'https://developers.amadeus.com/self-service/apis-docs/guides/$1');
document.write(`<meta http-equiv="refresh" content="0;url=${redirectUrl}" />
<link rel="canonical" href="${redirectUrl}" />`);
}
</script>
{% endblock %}
{% block extrahead %}
<script>
if (window.location.hostname === 'amadeus4dev.github.io') {
console.log(window.location.hostname);
const path = window.location.pathname;
const redirectPattern = /^\/([^/]+)/;
const redirectUrl = path.replace(redirectPattern, 'https://developers.amadeus.com/self-service/apis-docs/guides/$1');
document.write(`<meta http-equiv="refresh" content="0;url=${redirectUrl}" />`);
}

// Add event listener to all links starting with developers.amadeus.com
document.querySelectorAll('a[href^="https://developers.amadeus.com"]').forEach(link => {
link.addEventListener('click', function (e) {
e.preventDefault(); // Prevent the default action (navigating to the link)
window.location.href = this.href; // Manually redirect the page to the link
});
});
</script>
{% endblock %}

0 comments on commit cf1b06b

Please sign in to comment.