2
0

tutorial03.rst 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Tutorial Part 3: Navbar & Footer
  2. ================================
  3. Let's begin to work on our navigation and footer setup.
  4. .. _navbar:
  5. Customizing the navigation
  6. --------------------------
  7. The general layout of your navbar can be found in the **Settings > Layout**
  8. section of the Wagtail Admin. We previously discussed choosing a dark or
  9. light navbar and adding Bootstrap classes, but you can also add/remove the
  10. Search bar, set it to fixed (stays at the top even when you scroll) or full-width,
  11. decide on which screen size it will collapse into a menu hamburger, and whether to
  12. center the logo at the top or keep it toward the left-hand side.
  13. .. note::
  14. In Layout, we added the Bootstrap background color class ``bg-warning`` but you can choose whatever
  15. you like for your site. We also decided to remove the Search Bar from the Navbar by de-selecting the
  16. option to show the Search Bar. It's recommended to review all of the available settings, and go ahead
  17. and play around with them!
  18. Create your menus
  19. -----------------
  20. Your navbar will have links to your other pages or external content that you want
  21. to share. To build your menu, go to **Snippets > Navigation Bars**.
  22. In the top right-hand corner is a button that says **Add Navigation Bar**.
  23. Click on this button to start! (Alternatively, you can also click on the link that says "Why not add one?")
  24. .. figure:: img/tutorial_new_nav_edit1.png
  25. :alt: The edit screen for adding a navbar.
  26. The edit screen for adding a new navbar
  27. Name your navbar. In this case, this will be our main navigation bar so we have simply named it
  28. Main Nav.
  29. There are three types of links that you can add to your navbar. Let's briefly describe each one:
  30. * **Page link with sub-links** - Add links to pages from within your website. Add sub-links for dropdown items.
  31. * **External link with sub-links** - Add external links from other websites to your site, as well as sub-links.
  32. * **Document link with sub-links** - Add document links with sub-links to your navbar.
  33. We don't have any other pages set up yet, but we can still create our menu. For now, we will just link to
  34. the Home page and update it once we have more pages.
  35. .. figure:: img/tutorial_navbar_add_item1.png
  36. :alt: Adding a menu item with page link.
  37. The edit screen with our first navbar item.
  38. Continue to add as many navbar items as you want for your website. You can always edit your menu and add more
  39. top-level items or dropdowns as you make more pages. We are going to start with our three most important ones
  40. for our sweets shop!
  41. .. figure:: img/tutorial_navbar_front1.png
  42. :alt: Our menu added to the navbar - front view.
  43. The website with our menu added. Also note that we are using some Bootstrap colors on the site.
  44. Site Navbars Settings
  45. ---------------------
  46. After you create your navbar, go to **Settings > Layout** and scroll down to **Site Navbars**. Click on the plus sign
  47. to select your new navbar and add it to your site. The Save.
  48. .. _footer:
  49. Customizing the Footer
  50. ----------------------
  51. Now, let's head down to work on the footer, which is another menu of links. You can add more links in the footer
  52. that maybe won't belong in the main navigation but are still important. Go to **Snippets > Footers** to begin
  53. working on the footer. In the top right-hand corner is a button that says **Add Footer**. Click on this button to start!
  54. (Alternatively, you can also click on the link that says "Why not add one?")
  55. Give your footer a name. We choose Main Footer since this will be the main footer for our site.
  56. Let's get some practice with Responsive Grid Rows and Columns! We want to make a 4-column footer with our logo in the
  57. first column, our sub-page links in the second column, our main page links in the third column, and contact
  58. information in the fourth column. Don't worry - This is actually going to be easy!
  59. .. note::
  60. To keep up with our color scheme, we have also added a Bootstrap background color class to the
  61. Attributes section. See `Bootstrap color utilities <https://getbootstrap.com/docs/4.3/utilities/colors/#background-color>`_.
  62. .. figure:: img/tutorial_footer_edit1.png
  63. :alt: Getting started on our footer.
  64. The edit screen as we prepare to begin adding the layout for the footer.
  65. To set up our 4-column footer, choose **Responsive Grid Row** from the layout choices at the bottom. Now click on
  66. **Add Column**. You can specify the column size in the dropdown that says **Column size**. Since we want to have
  67. four evenly sized columns, we are going to choose a 1/4 Column size.
  68. .. note::
  69. Bootstrap uses a 12-column grid, and our footer is going to span the entire 12 columns. To figure out
  70. how to size our columns, we do some math. We are slicing up the 12-column grid into fourths to have four columns,
  71. so our columns need to be 1/4 each. Read more about Bootstrap grids and columns here: `Bootstrap Grid <https://getbootstrap.com/docs/4.0/layout/grid/>`_.
  72. From within the Responsive Grid Row block, keep selecting the + sign below your **Column** until you have all of
  73. the columns that you need. Then remember to make sure to choose the size of the column if you have a particular
  74. layout in mind. Otherwise, it will automatically size on its own.
  75. .. figure:: img/tutorial_footer_edit2.png
  76. :alt: Our Responsive Grid Row and Columns set up.
  77. The edit screen as we set up our layout for the footer.
  78. Add Content to the Footer
  79. -------------------------
  80. Now that we have our layout, let's begin adding content! You see that there are several different choices for content
  81. available within the column block.
  82. 1. We're going to choose the **Image Link** block in the first column so that we can add
  83. our logo and link to the Home page.
  84. .. figure:: img/tutorial_imagelink_example.png
  85. :alt: Our logo added as an image, the Home page linked, and Alt Text added.
  86. The edit screen for the Image Link block in our first column.
  87. 2. In the second through fourth columns, we are going to choose the Text block and list the Pages that we want to
  88. link to and our contact information. You can add links in the text block by highlighting the text and selecting the chain-link icon,
  89. then choosing which page or external link you want. See our example below:
  90. .. figure:: img/tutorial_footer_edit3.png
  91. :alt: Our footer with our text blocks and page links added.
  92. The edit screen for our footer with our content added.
  93. 3. Once you're happy with your Footer, hit **Save**. Let's see what it looks like!
  94. .. figure:: img/tutorial_footer_previews.png
  95. :alt: What our footer looks like on the website.
  96. What our footer looks like on the website.
  97. Remember, we have done minimal styling on the site.
  98. Site Footers Settings
  99. ---------------------
  100. After you create your footer, go to **Settings > Layout** and scroll down to **Site Footers**. Click on the plus sign
  101. to select your new footer and add it to your site. The Save.