Editing Default Templates
Getting Started Editing
This guide assumes that you understand Django and how Django template inheritance works. For more information on the Django template tags, and tags that are Ellington specific, see the Documentation link in your admin. If you need an overview of how templates work, see here.
The first step is to get connected to the templates folder. To do so, see our guide here. For those that choose our out-of-the-box templates, they will be the set of templates that appear in your site(s) folder when the site is released to you. They come fully commented for you to quickly be able to modify and update them with the necessary graphics and information to get your site off the ground. The first thing you'll need to do is open base.html and update the following information:
- SITE TITLE
- CUSTOM CSS
- This will be anything you want to add beyond
- SITE FAVICON
- CUSTOM HEADER SCRIPTS
- such as AMP specific, GAM, or Structured Content
- WEATHER
- The closest weather station from: http://www.rap.ucar.edu/weather/surface/stations.txt
- SITE LOGO (preferably in SVG)
- MENUS
- User Menu - Named exactly like this, this menu is for logged-in users.
- Account Menu - Named exactly like this, this is for the login/logout buttons
- Main Menu - Named exactly like this, this is the main header menu.
- SOCIAL MEDIA ICONS AND LINKS
- This uses regular font-awesome icons, so create as many <li> as you need and just choose the class for the appropriate network from: https://fontawesome.com/v5.15/icons (unless you use your own).
- TOP 728x90 AD UNIT
- Add in the ad unit code from your ad server.
- BOTTOM 728x90 AD UNIT
- Add in the ad unit code from your ad server.
- FIRST FOOTER AREA
- This could be another menu, static text via a fragment, or any of the template tags in the docs.
- SECOND FOOTER AREA
- This could be another menu, static text via a fragment, or any of the template tags in the docs.
- THIRD FOOTER AREA
- This could be another menu, static text via a fragment, or any of the template tags in the docs.
- FOURTH FOOTER AREA
- This could be another menu, static text via a fragment, or any of the template tags in the docs.
- FOOTER LOGO
- Usually a smaller version of the main logo.
- FOOTER SOCIAL MEDIA
- Same as above, just larger icons.
- FOOTER LEGALS AND COPYRIGHT
- Links to flatpages and linkbacks to homepage.
- FOOTER SCRIPTS
- Any JS you need ran after the page loads.
Once this is complete you can open homepage.html and continue with the notes in this file. Typically this is just updating the sections that appear on the homepage to reflect the sections you've set up. For information on setting up sections, see here.
Editing default CSS
You'll see in base.html that we call the default bootstrap css. This is called style.css and is usually located in your static media folder. The exact path will vary depending on your site name. Realistically only 5 lines in this file need to be modified. At the very top in the root variables sections you'll see:
--first: #008DFF;
--second: #FF3333;
--third: #5e50f9;
--font-family-heading: 'Roboto Condensed', sans-serif;
--font-family-body: 'Roboto', sans-serif;
The first 3 represent the 3 main colors for your site, and updating these 3 lines will change the colors throughout the entire site. The last 2 are the default fonts used. The CSS sheet already has fallback font sin place for older browsers that don't support CSS variables so you don't need to worry about those. font-family-heading controls the font on all the <h> tags and font-family-body controls all of the body text on stories and flatpages. Of course, you are free to modify any of the other elements inside this file but we highly recommend that you create a custom CSS file and include it in base.html to accomplish this.
In the example above, the first variable is the main site color, the second variable is for accents and in some cases, there may be a third variable that is usually very minor things on specific pages like sponsored content headers and such. In most cases, the third color isn't used.
Conclusion
Save all the files and reload your site (if you're using FTP you'll need to upload the files first). If you need to clear the site cache to view your changes, you can add ?no_cache to the end of any URL.
0 Comments
Add your comment