Conditional anchor in structure url I have a structure section, where the last child should be an anchor in the slug:

parent/parent#child

I'm trying to setup conditional url formats on nested entries as such:

{parent.uri}{% if object.getDescendants().total() != 0 %)/{% else %}#{% endif %}{slug}

I've also tried the simpler

{parent.uri}{% if object.hasDescendants %)/{% else %}#{% endif %}{slug}

but keep getting stuck tasks when re-saving entries. Can someone tell me what I'm doing wrong? Thanks in advance
There was a typo hidden in there, otherwise the logic works. To get children as anchors in a structure, the following should do the trick:

{parent.uri}{% if object.getDescendants().total() != 0 %}/{% else %}#{% endif %}{slug}