I want to create a custom template for Magento ver.2.0.7 and am trying to find the location of the main HTML file. i.e. The file that is loaded when I go to my Magento URL.

Can I extend this HTML file to add Bootstrap elements?

2 Answers 2


Magento does not have a main HTML. It has an index.php that is called when you enter in your store. This php file will "build" the layout of your store, load images, CSS, javascript files, insert blocks, etc; which means that the final HTML that you see in your home page is not a single file.

The best way to change your layout is creating a custom theme. You should not modify Magento files.

I didn't work with Magento 2 yet, but this link explains how to create your theme. And yes, you can use bootstrap elements.

  • Thanks, is it correct to assume that templates can only affect how elements are shown/group but they don't handle any logic e.g. using template A it displays <div1> but using template B displays <div2>?
    – Nikkawat
    Jun 30, 2016 at 23:21
  • @Nikkawat sorry for the delay. Templates will have CSS and Javascript files, which you can use to simple logic like that. You can for example have a different layout for mobile and desktop, etc. Jul 6, 2016 at 15:58
  • no problem, I finally understood how Magento renders the pages via .phtml files and made changes as needed in my extended files.
    – Nikkawat
    Jul 6, 2016 at 17:49
  • Sounds good! Good luck in your project! Jul 6, 2016 at 20:15

Not all layout customizations can be performed by extending existing layouts. If the amount of customizations is large, you can use the overriding function for the needed layout file. This means that the new file that you place in the theme will be used instead of the parent theme layout file of base layout file.

In this article, page layouts, page configurations, and generic layouts are referred to as layout files, as the mechanism of overriding is similar for all of them.

Layout files with instructions that override the default or parent theme files are referred to as overriding layout files.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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