Creating a theme logo
By default, in Magento 2 the theme logo is always recognized by the system with the name logo.svg
. The Magento 2 also recognizes the logo's default directory as <theme_dir>/web/images/logo.svg
. So, if you have a logo.svg
file, you simply put the file in the right directory.
But if you want to work with a different logo name with a different format, you have to declare it in Magento by using the layout files declaration. We will make a declaration for this new logo in the Magento_Theme
directory, because the new logo overrides the Magento_Theme
module.
We will override this module by taking advantage of the fallback system. As you may have noticed, Magento has a specific pattern of declaring elements. It's the way that Magento organize its life cycle.
Let's declare a new theme logo:
Choose one logo for the example and save the file as
logo.png
inapp/design/frontend/Packt/helloworld/Magento_Theme/web/images
directory.Move your new
logo.png
image to theimages
directory...