Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried so may things but unable to add the CSS & JS files for each Static CMS pages. I know if CSS can be added in cms_page_view.xml but this will reflect in all pages.

is there anyway to add different CSS files for different static pages.

share|improve this question

In magento all CMS pages have an option of Layout Update XML update .Just Call your Custom code there also add CSS or JS .

Admin CMS Pages

GOTO ADMIN -> Content -> Pages -> Edit page -> Design -> Layout Update XML

add below call

<head>
  <css src="Namespace_YourModule::css/styles.css"/>
</head>
share|improve this answer
    
this works in page layout configuration not in Layout Update XML , hope you checked... – Mohammad Mujassam Jul 21 '16 at 4:44
    
It is working fine I have tested this code . just remove "Namespace_YourModule::" and set in to "Layout Update XML" and refresh you Cache so you can show in that page only. – Hitesh Vaghasiya Jul 21 '16 at 18:59
    
Please correct the XML data and try again. Element 'head': This element is not expected. Expected is one of ( referenceContainer, container, update, move ). Line: 1 this we will get if we put anything else apart from above four Element. I am using magento 2.0.7 – Mohammad Mujassam Jul 22 '16 at 4:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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