Exercise: Creating Article containers
Step 1: Set the global Content and Wide Size
- Open the
theme.json
in the editor. - Add a
settings
key at the root. The value is an object. - Add a
layout
key inside of settings
. The value is an object. - Add a
contentSize
key inside of layout
, and set the value to 520px
. - Add a
wideSize
key inside of layout
, and set the value to 750px
. - Verify that the content and wide size are working in the Content Editor.
Step 2: Use the Content Size for the Content block
- In the Site Editor look for the Content block in the Index template.
- Select the block and toggle Inner blocks use content width in the settings sidebar.
- Verify that the sizes are working on the frontend.
Step 3: Implement the Article Containers
Article wrapper
- Add the Title, Content, and Date blocks into a Group block.
- Toggle the content width off.
- Set the HTML element to
<article>
. - Name the block "Article".
Article Header
- Inside of the Article Group, add a new Group, and add the Title into it.
- Toggle the content width off.
- Set the HTML element to
<header>
. - Name the block "Article Header".
Featured Image
- Add the Featured Image block after the Article Header block.
- Move the Content block below the Featured Image.
Article Footer
- Inside of the Article Group, add a new Group, and add the Date into it.
- Toggle the content width off.
- Set the HTML element to
<footer>
. - Name the block "Article Footer".
Template Structure
Complete and Continue