ByteEditor Site Builder
Create layout
By following the steps in this instruction, you will be able to create your custom four-column layout. You can use the code snippets provided in the guide to recreate this layout, or you can modify the steps to tailor the layout to your specific needs.
In order to create a layout, for example, Four Columns Layout, we need a back office view, a controller, and a front view
Step 1. Basic changes to the code
- Open the project folder
- Open the “App_Plugins” folder
- Create a folder for custom layouts, for example, name “CustomBlockView”
- Create a test document named “fourColumnLayout.html”
- Please copy the following code and paste it into the file
6. Create a test document named “fourColumnLayout.controller.js”
7. Copy the following code and paste it into the file
8. Go to the Umbraco website
9. Create a test document named “package.manifest” in the “CustomBlockView” folder.
10. Add the following JSON to the package.manifest file:
Step 2. How to create a layout in Umbraco
1. Run your project locally where the “ByteEditor Site Builder 1.X” package is installed.
2. Open the tab “Settings”.
3. Expand the Document Types folder.
4. Hover over the "Blocks" folder in the content tree you will see this icon '...'. Click the icon '...'.
5. Click the “Create” button.
6. Select “Element type” from the list.
7. Name the "Four Columns Layout" block.
8. Add an icon for the layout.
9. On the right side, next to the “lock” icon, change the text from “fourColumnsLayout” to “fourColumnsLayoutBlock”.
10. Click on the "Add groups" button
11. Name the group “Content”
12. Click on the "Add property" button
13. Name the property “Background picture”
14. Click on the "Select editor" button
15. Select “Image Media Picker” from the list
16. Click on the "Submit" button
17. On the right side of the screen, find the “Compositions” button and click on it.
18. Scroll to the “/Blocks/Compositions/” block
19. Select the “Section Margins” and “Section Settings” checkboxes
20. Click on the "Submit" button
21. Click on the "Save" button
Step 3. How to add Layout to the Block Grid
- Open the Block Grid page
- Click on the “Content” block
- Click the "Edit" button for "Home - Main Grid - Block Grid"
- Click the “Add block” button
- Choose "Four Columns Layout" from the list
- Make the “Allow in areas” field inactive
- Click the " Areas" button
- Click the " Add" button for the Areas block
- For the “Alias” field, enter “First”
- Click on the "Submit" button
- Specify the width of “3 columns”
- Click the " Add" button for the Areas block
- For the “Alias” field, enter “Two”
- Click on the "Submit" button
- Specify the width of “3 columns”
- Click the " Add" button for the Areas block
- For the “Alias” field, enter “Three”
- Click on the "Submit" button
- Specify the width of “3 columns”
- Click the " Add" button for the Areas block
- For the “Alias” field, enter “Four”
- Click on the "Submit" button
- Specify the width of “3 columns”
- Click the " Advanced" button
- Add the path to the .html file for the Custom view field
~/App_Plugins/CustomBlockView/fourColumnLayout.html - Add the path to the .css file for the “Custom stylesheet” field
~/css/index.min.css - Save your changes
Step 4. How to create a Layout view on the front end
- Expand the "Partial Views" folder.
- Expand the "blockgrid" folder.
- If you hover over the "Components" folder in the content tree, you will see this icon: '...'. Click the icon.
- Select “New empty partial view” from the list.
- In the name field, write “fourColumnsLayoutBlock.cshtml”
- Please copy the following code and paste it into the file
7. Click on the "Save" button
8. Restart the project
Congratulations!
You have created your first layouts. Now you can add it to your page and fill with the elements.