Lab - Regions
Lesson 7 of 23 · 30 min
In this lab you will…
- Add a new widget region to a Stencil template file
- Create a global region
- Place a widget in the global region
Prerequisites
- BigCommerce sandbox store
This lab uses ‘Edit Theme Files’ as an ad hoc way to add regions to a theme. In a typical workflow, you would add regions to the theme’s template files locally with Stencil CLI, then bundle and deploy the theme to your store. To learn that setup and deploy workflow, see the Stencil Core course.
Add a Region
Add a new widget region to a Stencil template file
- Log in to the BigCommerce store that you have access to
- Navigate to ‘Storefront’ in the left navigation
- Click the ‘Advanced’ menu on the currently applied theme
Themes must be copied before the ‘Edit Theme Files’ option is available. You cannot edit the original version of the theme. Click the ‘Advanced’ menu on the theme, then ‘Make a Copy’ to copy your theme.
- Click ‘Edit Theme Files’
- Add the following code to the templates/pages/home.html template file:
templates/pages/home.html
- Click ‘Save File’ in the bottom right corner of the ‘Edit Theme Files’ window
Create a Global Region
- Log in to the BigCommerce store that you have access to
- Navigate to ‘Storefront’ in the left navigation
- Click the ‘Advanced’ menu on the currently applied theme
- Click ‘Edit Theme Files’
- Add the following code at the end of the ‘main full’ div tag in home.html to at the end of the ‘page-content’ div tag in category.html as shown in the examples below:
templates/pages/home.html
templates/pages/category.html
View the Regions in Makeswift
You can view the regions you added in Makeswift:
- Open the store control panel and go to the Channel Manager
- Select the Makeswift-connected channel and click Edit in Makeswift
- Navigate to the home page in the editor
- Observe the home-top region and the below_content—global region as places where you can add content
View the Regions in Page Builder
You can view the same regions in Page Builder:
- Navigate to channel manager > edit themes in the control panel
- Click Customize
- Launch Page Builder
- Scroll to the bottom of the home page
- Observe the below_content—global region under the non-global region below New Products
Place a Widget in the Global Region
Complete these steps in your editor of choice.
- Drag and drop one of the basic widgets into the
below_content--globalregion - Observe the widget you just placed displaying on the home page and the category pages of your store
- Publish the changes and view the live storefront