hubspot-cms-vscode icon indicating copy to clipboard operation
hubspot-cms-vscode copied to clipboard

CTA tag & function says GUID is null if default flag is used

Open erik4github opened this issue 2 years ago • 0 comments

Both the CTA tag and function end up saying Invalid GTA guid null if the default filter is used.

Example:


    {% set cta_to_render = (
        module.sidebar_cta_tag_collection 
        | selectattr('tag', 'in', content.tag_list|map('id')) 
        | first 
        | attr('cta') 
        | default(module.sidebar_cta_default)
        ) 
    %}
    {{ cta("{{ cta_to_render }}")  }} 

shows Invalid GTA guid null in my VSCode Problems terminal. However viewing the page with the debug mode query parameter shows no template errors, and the behavior is expected (it renders the value of module.sidebar_cta_default if none of the previous filters returned anything.

Removing the default filter:


    {% set cta_to_render = (
        module.sidebar_cta_tag_collection 
        | selectattr('tag', 'in', content.tag_list|map('id')) 
        | first 
        | attr('cta') 
        ) 
    %}

    {{ cta("{{ cta_to_render }}")  }} 

Shows no problems in VSCode terminal.

This also happens with the CTA tag, e,g {% cta guid="{{ cta_to_render }}" %}

I tested this with the default key in fields.json populated and unpopulated, doesn't seem to make a difference.

erik4github avatar Mar 23 '22 16:03 erik4github