How to use custom field in Shopware 5 item url?

I am trying to use a custom field’s value in seo url template in shopware but it does not seem to work.

The guide here does the exact same thing what I do:

https://docs.shopware.com/en/shopware-5-en/settings/seo

SEO URLs item template:

deal/{if $sArticle.custom_url}{$sArticle.custom_url}{else}{$sArticle.supplier|replace:'.':'' }-{$sArticle.name|replace:'.':'' }{/if}

Is there something wrong with this part?

{if $sArticle.custom_url}{$sArticle.custom_url}{/if}

Did you generate the URLs?

@NextMike‍ yes I did generate the SEO urls as well as cleared the cache several times. The custom field has a value for the product that I test, but it always seem to go to the else case.

When I debug the {$sArticle.custom_url} in frontend template, it is shown there but I guess that it is not giving a value for the url. Any clues on that?

To be sure use the standard attr1 - attr19 fields. Like that: {$sArticle.attr4}

@NextMike‍ the usage of an if clause is also acceptable here, isn’t it?

@NextMike‍ it worked with the attr1, do you have any idea why it didn’t work with a new custom field?

I believe the fields are not available to the router. Just use the attr1-19. Yes, you can use all smarty commands.

@NextMike‍ thank you very much, that helped me a lot indeed.