Use same handle for different fields on different entry types I've got two entry types: blog and job. Each has a category field but different category groups: blogCategories and jobCategories. I would like to write a Twig include to accept either a blog or a job and display its categories like:
&lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
&lt;p&gt;{{ entry.category.all()|column('title')|join(', ') }}&lt;/p&gt;

Is there any way to do this? I tried creating two fields, both called categories but the field handle has to be unique. Is there such a thing as a field alias?
You need two different fields since you can only select one category group per category field. As you said, having two fields with the same name isn't possible. One way to work around this would be to add a behaviour that checks the entry type and returns the categories from the corresponding field (i.e. jobCategories for job entries and blogCategories for blog entries).
However, this is more complicated than it needs to be. You can just define a macro and pass it the appropriate field depending on the template:
{# macros/macros.twig #}
{% macro category_list(categoryQuery) %}
    &lt;p&gt;{{ categoryQuery.all()|column('title')|join(', ') }}&lt;/p&gt;
{% endmacro %}


{# blog/_entry.twig #}
{% from &quot;macros/macros.twig&quot; import category_list %}

&lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
&lt;p&gt;{{ category_list(entry.blogCategories) }}&lt;/p&gt;


{# job/_entry.twig #}
{% from &quot;macros/macros.twig&quot; import category_list %}

&lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
&lt;p&gt;{{ category_list(entry.jobCategories) }}&lt;/p&gt;

If you have a single entry template for both entry types, you can also check the different fields inside the macro:
{# macros/macros.twig #}
{% macro category_list(entry) %}
    {% switch entry.type.handle %}
        {% case &quot;job&quot; %}
            {% set categories = entry.jobCategories.all() %}
        {% case &quot;blog&quot; %}
            {% set categories = entry.blogCategories.all() %}
        {% default %}
            {% set categories = [] %}
    {% endswitch %}
    &lt;p&gt;{{ categories|column('title')|join(', ') }}&lt;/p&gt;
{% endmacro %}


{# entry/_entry.twig #}
{% from &quot;macros/macros.twig&quot; import category_list %}

&lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
&lt;p&gt;{{ category_list(entry) }}&lt;/p&gt;