I need to integrate addthis widget on CMS page. In my custom them I created xml file cms_page_view.xml which resides at app/design/frontend/Vendor/Themename/Magento_Theme/layout/
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
<script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-1234567890" src_type="url" />
</head>
</page>
I can see the social sharing icons appearing on that CMS page, but as I have included it from xml, it appears on all CMS page of the store
I tried including below xml from Design tab in Layout Update XML in admin
<reference name="head">
<block type="core/text" name="shop-by-project">
<action method="setText"><text><![CDATA[<script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-1234567890" />]]></text></action>
</block>
</reference>
It gives exception Please correct the XML data and try again. Element 'reference': This element is not expected. Expected is one of ( referenceContainer, container, update, move ). Line: 1
- How do I include external and internal javascript for specific CMS page making sure it does not load in other CMS and product pages?