Skip to main content
added 32 characters in body
Source Link
Jamie Wade
  • 3.6k
  • 2
  • 17
  • 32

You are close, instead of checking entry|length, you can do {% if entry is defined %}:

{% if entry is defined and entry.sectionId == 1 %}

So if I am understanding correctly, the full code will be:

{% if entry is defined and entry.sectionId == 1 %}

    //  Redirect to homepage

{% else %}

    // Do some checking into whether there's a corresponding entry, etc.

{% endif %}

You are close, instead of checking entry|length, you can do {% if entry is defined %}:

{% if entry is defined and entry.sectionId == 1 %}

So the full code will be:

{% if entry is defined and entry.sectionId == 1 %}

    //  Redirect to homepage

{% else %}

    // Do some checking into whether there's a corresponding entry, etc.

{% endif %}

You are close, instead of checking entry|length, you can do {% if entry is defined %}

{% if entry is defined and entry.sectionId == 1 %}

So if I am understanding correctly, the full code will be:

{% if entry is defined and entry.sectionId == 1 %}

    //  Redirect to homepage

{% else %}

    // Do some checking into whether there's a corresponding entry, etc.

{% endif %}
Source Link
Jamie Wade
  • 3.6k
  • 2
  • 17
  • 32

You are close, instead of checking entry|length, you can do {% if entry is defined %}:

{% if entry is defined and entry.sectionId == 1 %}

So the full code will be:

{% if entry is defined and entry.sectionId == 1 %}

    //  Redirect to homepage

{% else %}

    // Do some checking into whether there's a corresponding entry, etc.

{% endif %}