How to include file on specific pages

Hi, I have included file in my template using this code

{{ require_js(get_asset_url("/Focus-child/templates/custom/js/custom.js"), { position: "footer", async: true }) }}

but this code also runs in backend. I want this file to run code only on front end. Is there any code snippet to include this file only on front end and not on backend? thanks

Hi @RKhan33,

by backend you mean the page-builder, right?

If so - you can wrap the whole code in

{% unless is_in_page_editor %}
YOUR CODE
{% endunless %}

you can read more about this in the march 23 changelog post

best,

Anton