2
0

tutorial03.rst 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. .. _footer:
  45. Customizing the Footer
  46. ----------------------
  47. Now, let's head down to work on the footer, which is another menu of links. You can add more links in the footer
  48. that maybe won't belong in the main navigation but are still important. Go to **Snippets > Footers** to begin
  49. working on the footer. In the top right-hand corner is a button that says **Add Footer**. Click on this button to start!
  50. (Alternatively, you can also click on the link that says "Why not add one?")
  51. Give your footer a name. We choose Main Footer since this will be the main footer for our site.
  52. Let's get some practice with Responsive Grid Rows and Columns! We want to make a 4-column footer with our logo in the
  53. first column, our sub-page links in the second column, our main page links in the third column, and contact
  54. information in the fourth column. Don't worry - This is actually going to be easy!
  55. .. note::
  56. To keep up with our color scheme, we have also added a Bootstrap background color class to the
  57. Attributes section. See `Bootstrap color utilities <https://getbootstrap.com/docs/4.3/utilities/colors/#background-color>`_.
  58. .. figure:: img/tutorial_footer_edit1.png
  59. :alt: Getting started on our footer.
  60. The edit screen as we prepare to begin adding the layout for the footer.
  61. To set up our 4-column footer, choose **Responsive Grid Row** from the layout choices at the bottom. Now click on
  62. **Add Column**. You can specify the column size in the dropdown that says **Column size**. Since we want to have
  63. four evenly sized columns, we are going to choose a 1/4 Column size.
  64. .. note::
  65. Bootstrap uses a 12-column grid, and our footer is going to span the entire 12 columns. To figure out
  66. how to size our columns, we do some math. We are slicing up the 12-column grid into fourths to have four columns,
  67. 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/>`_.
  68. From within the Responsive Grid Row block, keep selecting the + sign below your **Column** until you have all of
  69. the columns that you need. Then remember to make sure to choose the size of the column if you have a particular
  70. layout in mind. Otherwise, it will automatically size on its own.
  71. .. figure:: img/tutorial_footer_edit2.png
  72. :alt: Our Responsive Grid Row and Columns set up.
  73. The edit screen as we set up our layout for the footer.
  74. Add Content to the Footer
  75. -------------------------
  76. Now that we have our layout, let's begin adding content! You see that there are several different choices for content
  77. available within the column block.
  78. 1. We're going to choose the **Image Link** block in the first column so that we can add
  79. our logo and link to the Home page.
  80. .. figure:: img/tutorial_imagelink_example.png
  81. :alt: Our logo added as an image, the Home page linked, and Alt Text added.
  82. The edit screen for the Image Link block in our first column.
  83. 2. In the second through fourth columns, we are going to choose the Text block and list the Pages that we want to
  84. link to and our contact information. You can add links in the text block by highlighting the text and selecting the chain-link icon,
  85. then choosing which page or external link you want. See our example below:
  86. .. figure:: img/tutorial_footer_edit3.png
  87. :alt: Our footer with our text blocks and page links added.
  88. The edit screen for our footer with our content added.
  89. 3. Once you're happy with your Footer, hit **Save**. Let's see what it looks like!
  90. .. figure:: img/tutorial_footer_previews.png
  91. :alt: What our footer looks like on the website.
  92. What our footer looks like on the website.
  93. Remember, we have done minimal styling on the site.