How do I grab the current page's parent name? #7101
Answered
by
squidfunk
LizThompson93
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
squidfunk
Apr 26, 2024
Replies: 1 comment 1 reply
-
Thanks for the praise! I'm glad our work is useful to you ❤️
{% if page.ancestors %}
{{ page.ancestors[0] }}
{% endif %} Feel free to share your final solution, when you managed to work something out, so others can benefit as well |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
LizThompson93
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the praise! I'm glad our work is useful to you ❤️
page.ancestors
contains the list of ancestors in increasing levels, sopage.ancestors[0]
should be what you're looking for. Note that you should safe guard for the case when there are no ancestors, but something like the following should work, which means you should be able to integrate this into yourfooter.html
override:Feel free to share your final solution, when you managed to work something out, so others can benefit as well☺️