Created
September 8, 2021 15:54
-
-
Save Cloud-Awesome/35e4b4415c84c5712a669ec30fc85d0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign stop = false %} | |
{% assign next_url = "" %} | |
{% comment %} | |
Loop through all siblings of the current page (i.e. this page's parent's children) | |
Unfortunately, I haven't found any other liquid object that allows us to get "next sibling" ;) | |
{% endcomment %} | |
{% for child in sitemap.current.parent.children %} | |
{% comment %} If, in the last itteration, it found the current page, this is the next page, set URL and exit {% endcomment %} | |
{% if stop == true %} | |
{% assign next_url = child.url %} | |
{% break %} | |
{% endif %} | |
{% comment %} If this sibling is the current page, the next one will be the one we want {% endcomment %} | |
{% if child.url == page.url %} | |
{% assign stop = true %} | |
{% endif %} | |
{% endfor %} | |
{% comment %} Use URL of next sibling page, appending any URL parameters (e.g. ?id=xxx) {% endcomment %} | |
<a id="anon-submit" href="{{ next_url }}{{ request.query }}" class="submit-btn btn btn-primary form-action-container-left">Continue</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment