How can I get the top level ancestor of an entry within a structure? I've tried:
{% set rootEntry = null %}
{% for ancestor in entry.getAncestors() %}
{% set rootEntry = ancestor %}
{% endfor %}
But that only returns the most recent ancestor back and doesn't go all the way up the chain.
$entry->getAncestors()->level(1)->one()– tenshi Jan 10 '24 at 02:09