0

I am using cleversoft novetty theme. My newsletter pop-up appears on all pages that's so irritating. I want it to display only once at homepage whenever someone visits my site. here is the coding of default.xml :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="head.components">
        <block class="Magento\Framework\View\Element\Js\Components" name="newsletter_head_components" template="Magento_Newsletter::js/components.phtml"/>
    </referenceBlock>
    <referenceContainer name="footer">
        <block class="Magento\Newsletter\Block\Subscribe" name="form.subscribe" as="subscribe" before="-" template="subscribe.phtml"/>
    </referenceContainer>
</body>

What can I change in this so that it displays only on front page and not on all pages?

0

Create cms_index_index.xml and add your code to show popup only on Home page

For Custom theme:

app/design/frontend/{Vendor}/{theme}/Magento_Cms/layout/cms_index_index.xml

For custom Module:

app/code/{Vendor}/{Module}/view/frontend/layout/cms_index_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="head.components">
        <block class="Magento\Framework\View\Element\Js\Components" name="newsletter_head_components" template="Magento_Newsletter::js/components.phtml"/>
    </referenceBlock>
    <referenceContainer name="footer">
        <block class="Magento\Newsletter\Block\Subscribe" name="form.subscribe" as="subscribe" before="-" template="subscribe.phtml"/>
    </referenceContainer>
</body>

Set cookie to show popup only one time. Refer this answer for how you can set and get cookie: https://magento.stackexchange.com/a/100142/35758

0

Stores -> Configuration -> CLEVERSOFT EXTENSIONS

Open CleverNewsletter Option

there have option Selected pages open it ->

select No from Show on All pages and select page you want to set NEwsLetter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.