Skip to main content

Remove hidden elements from the DOM using conditional logic

In concrete terms, I use an accordion system to mimic an FAQ.

In my Shopify back office, I created meta fields (e.g. FAQ #3 — Question + FAQ #3 — Answer).

On the Instant side, I say that if the field "FAQ #X — Question" is empty, then we don't display it. Everything works fine.

Problem: you don't remove it from the DOM. So for Google, this is a very bad signal. There are H3s that are effectively empty when this type of case occurs.

In your logic, it is necessary to remove an element that you want to hide from the DOM.

Status: Completed1 comment

Log in to comment and vote

Comments1

  • Doeke Leeuwis

    Team•

    Sep 21

    Resolved with Instant 2.0!

    The agent now has full control over the schema, so it can add any setting you define and use this conditionally to create dynamic layouts.

    If you can describe it, you can build it.