Support proposal to add "else with" like "else if" feature in templates

If you’d like to be able to write logic like this

{{ with $page.Resources.GetMatch $url }}
    {{ $result = . }}
{{ else with $page.Resources.Get $url }}
    {{ $result = . }}
{{ else with resources.GetMatch $url }}
    {{ $result = . }}
{{ else with resources.Get $url }}
    {{ $result = . }}
{{ else with resources.GetRemote $url }}
    {{ $result = . }}
{{ end }}

instead of like this

{{ with $page.Resources.GetMatch $url }}
    {{ $result = . }}
{{ else }}
    {{ with $page.Resources.Get $url }}
        {{ $result = . }}
    {{ else }}
        {{ with resources.GetMatch $url }}
            {{ $result = . }}
        {{ else }}
            {{ with resources.Get $url }}
                {{ $result = . }}
            {{ else }}
                {{ with resources.GetRemote $url }}
                    {{ $result = . }}
                {{ end }}
            {{ end }}
        {{ end }}
    {{ end }}
{{ end }}

then show your support here with an upvote or comment:

Thanks.

6 Likes

Thanks for the support :slight_smile:

1 Like

It’s been added to the active proposals list!

It’s not too late to add your upvote or comment!

This was approved today!

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.