Detecting if page is a 'category' or 'entry'
It'd be nice to see an example of your HTML block. From your comments it sounds like you may be using the same HTML block for Entry and Category pages but need to know which variable to use in the code.

Assuming you know that your code is running on the Entry or Category pages, and that the fields across both your Entries and Categories for this part of the page are the same, you can place your common HTML in an include and pass both the entry and category variable to that include with the same variable name.  In the example below, we're handing off the entry and category variables and using the variable name object in the include template:

_entry.html

{% include '_partials/shared-template' with { object : entry } %}


_category.html

{% include '_partials/shared-template' with { object : category } %}


_partials/shared-template

&lt;div&gt;
    {{ object.fieldName }}

    {% for item in object.someOtherFieldName %}
      {{ item }}
    {% endfor %}
&lt;/div&gt;


If some of the field names are different, you may need to use some conditional logic or reconsider what variables are being passed to the included template.  You could pass dissimilar variables under the same variable names to a common template in the following way:

index.html

{% if entry is defined %}
    {% include '_partials/shared-template' with { 
        title : entry.title,
        someOtherVariable: entry.fancyFieldOne
    } %}
{% endif %}

{% if category is defined %}
    {% include '_partials/shared-template' with { 
        title : category.title,
        someOtherVariable: category.fancyFieldTwo
    } %}
{% endif %}


_partials/shared-template

&lt;div&gt;
    {{ title }}

    {% for item in someOtherVariable %}
      {{ item }}
    {% endfor %}
&lt;/div&gt;