I'm using magento 2 and I'm trying to insert a javascript library into into my category page. I only need it so I can stick my sidebar , so I don't need them also on other pages , what is the right file to edit so I can add the libraries ?
Magento 2 – Add JavaScript Library Only on Category Page
javascriptlayoutmagento2requirejstemplate
Best Answer
You simple need to override
catalog_category_view.xml
file into your theme.code for
catalog_category_view.xml
file,custom.js file path is
app/design/frontend/{Vendor}/{theme}/web/js/custom.js
.Call your custom.js file inside theme list.phtml file with below code,
Without need of declare
requirejs-config.js
file you can directly call inside your category page.