Skip to content
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

Redirection via Javascript ... #27

Open
nfreear opened this issue May 25, 2017 · 0 comments
Open

Redirection via Javascript ... #27

nfreear opened this issue May 25, 2017 · 0 comments

Comments

@nfreear
Copy link
Owner

nfreear commented May 25, 2017

YAML front matter in page:

---
# ...

x-redirect-url: /2017/05/22/sign-machine.html
x-hash: '#id-sign-machine'
x-nav-class: sr-only
---

Top of the page -- includes/head.html:

{% if page.x-redirect-url %}

  <script>
  setTimeout(function () {
    var x_redirect_url = '{{ page.x-redirect-url }}' + ( location.search || '?' ) + '&utm_source=redirect' + '{{ page.x-hash }}';
    window.location = x_redirect_url;
  }, 2000 );
  </script>

  <p role="alert" class="big_me redirect"> Redirecting ... </p>

{% endif %}

Bottom of page -- _layout/default.html:

{% unless page.x-redirect-url %}

    {% include footer.html %}
    {% include footer-javascript.html %}

{% endunless %}

To make it accessible:

  • Put the re-direction Javascript in a setTimeout( ... ) - 2 or 3 seconds - ?
  • Add some text Redirecting ... with role=alert - ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant