From a previous question I learned how to add some static blocks to the CMS homepage like this: how to achieve this 2 columns page layout?
The xml is created in:
app/design/frontend/<Vendor>/<theme>/Magento_Cms/layout/cms_index_index.xml
Now if I want to have the same for other new created CMS page how to achieve that?
What would be the name for the xml file? I have tried things like cms_contact_contact.xml but that did not work?
Any suggestions?
-
You can add layout xml code to particular cms pages from admin. open cms page which you want to update, you can add.Suresh Chikani– Suresh Chikani2016年11月09日 07:08:08 +00:00Commented Nov 9, 2016 at 7:08
-
I know that way but as referred to, I would like to achieve that trough a xml file such as cms_index_index.xmlmr_typo3– mr_typo32016年11月09日 09:12:59 +00:00Commented Nov 9, 2016 at 9:12
-
Which page you need to it ?Suresh Chikani– Suresh Chikani2016年11月09日 09:21:03 +00:00Commented Nov 9, 2016 at 9:21
-
That does not matter so much. Just a (new created) cms page. See the example I referred to in my above question.mr_typo3– mr_typo32016年11月09日 09:29:28 +00:00Commented Nov 9, 2016 at 9:29
-
Then you have to include on every page and display it conditionally if page is cms, block is display other wise not display.Suresh Chikani– Suresh Chikani2016年11月09日 09:36:01 +00:00Commented Nov 9, 2016 at 9:36
1 Answer 1
You can directly add static block to cms page.
In backend, go to
Content -> CMS Page
Click on specific CMS page,
inside page,
go to Design Tab,
Set Layout Update XML code,
<referenceContainer name="content">
<block class="Magento\Cms\Block\Block" name="block_identifier">
<arguments>
<argument name="block_id" xsi:type="string">static_block_id</argument>
</arguments>
</block>
</referenceContainer>
In above xml code, Replace static_block_id with your block id.
Remove cache and check for specific page.
Your Block content are display only specific page.
-
I understand but its not an question to my answer. I would like to know how to get that through a xml file similar as cms_index_index.xml which is only applied to the cms homepage ? So how to get a similar xml.file which will be used by a specific named cms-page?mr_typo3– mr_typo32016年11月09日 09:16:15 +00:00Commented Nov 9, 2016 at 9:16