1

Fairly new to Magento 2. Working from a cloned version of another site and trying to make simple, cosmetic changes to the custom theme homepage here:

app/design/frontend/Vendor/Theme/Magento_Theme/layout/default.xml

Any change I make manifests immediately, but unrelated parts of the page break at the same time. Most of what's in page-header disappears, and a new div called nav-sections appears with all our categories in it.

These exact changes occur regardless of how I alter default.xml -- even adding a character to a string causes them.

My hunch is it's a question of workflow, and I'm still unclear about when and how Magento 2 decides to create and serve files from pub/static, generated, and var/generated.

I should also note that I'm making these changes in production mode, and that running deploy doesn't fix anything.

What am I doing wrong here?

  • In production mode, you need to deploy the static-content every time you make changes ! command : php bin/magento setup:static-content:deploy – PЯINCƏ Mar 21 '18 at 15:23
  • Thanks, but the layout breaks even before running the deploy command, and stays broken after running it. – mxtthxw Mar 21 '18 at 16:36
0

I think that you have removed some properties from your custom default.xml or you have some errors on it please try this:

  1. Copy the original default.xml from the parent theme to the custom one.
  2. Clear the content folder of : pub/static, var/view_preprocessed, var/cache

  3. Launch this command : php bin/magento setup:static-content:deploy -f

  4. Check line by line the property who breaks you layout.

0

It's simple solution.

by default Magento 2 just join file so core file with your get compile to one.

Block and component with are initialize with the same name as core will dissapear (after copying to theme folder).

You need to replace name in: app/design/frontend/Vendor/Theme/Magento_Theme/layout/default.xml

Change name attribute only in: <block... or <container... References don't need to be fixed. Be sure that name is uniquely across system.

Example:

From: <block class="Magento\Theme\Block\Html\Title" name="page.main.title" template="Magento_Theme::html/title.phtml"/>

To:

<block class="Magento\Theme\Block\Html\Title" name="custom.page.main.title" template="Magento_Theme::html/title.phtml"/>

WARNING: This will create new block after existing one. If you need to replace then replace <block... to <referenceBlock... as described in http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-instructions.html

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.