Last modified: Jan 10, 2023 By Alexander Williams
Preparing a Theme and create the base for pelican
In this lesson #2, we'll prepare our blog theme then we'll Create the Project Base Template
preparing the theme
As you know, Pelican comes without any template, so you need a template.
Many websites are offering free templates, and you can download your preferred template or download this template that we'll work in, you can download the template here Template link
After downloading your template, you need to create a folder named theme inside "theme" folder create two folders: templates folder for templates HTML and static folder for statics files.
After putting the files, your project should look like this:
yourproject/
├── content
│ └── (pages)
├── output
├── theme
| └── templates
| └── index.html
| └── about.html
| └── static
| └── js
| └── css
| └── img
├── tasks.py
├── Makefile
├── pelicanconf.py # Main settings file
└── publishconf.py # Settings to use when ready to publish
Create the Project Base Template
The base template as the frame for all pages in the application. It sets the top navigation bar, the site footer, and provides a body canvas for any page to customize.
In the template folder, create an HTML file named base.html and put inside of this file all parts of the template that duplicated in every template like header footer ...
base.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | <!-- Base.html --><!DOCTYPE html><htmllang="zxx"class="no-js"><head><!-- Mobile Specific Meta --><metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"><!-- Favicon--><linkrel="shortcut icon"href="img/fav.png"><!-- Author Meta --><metaname="author"content="colorlib"><!-- Meta Description --><metaname="description"content=""><!-- Meta Keyword --><metaname="keywords"content=""><!-- meta character set --><metacharset="UTF-8"><!-- Site Title --><title>Magazine</title><linkhref="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700"rel="stylesheet"><!-- CSS ============================================= --><linkrel="stylesheet"href="theme/css/linearicons.css"><linkrel="stylesheet"href="theme/css/font-awesome.min.css"><linkrel="stylesheet"href="theme/css/bootstrap.css"><linkrel="stylesheet"href="theme/css/magnific-popup.css"><linkrel="stylesheet"href="theme/css/nice-select.css"><linkrel="stylesheet"href="theme/css/animate.min.css"><linkrel="stylesheet"href="theme/css/owl.carousel.css"><linkrel="stylesheet"href="theme/css/jquery-ui.css"><linkrel="stylesheet"href="theme/css/main.css"></head><body><header><divclass="logo-wrap"><divclass="container"><divclass="row justify-content-between align-items-center"><divclass="col-lg-4 col-md-4 col-sm-12 logo-left no-padding"><ahref="index.html"><imgclass="img-fluid"src="theme/img/logo.png"alt=""></a></div><divclass="col-lg-8 col-md-8 col-sm-12 logo-right no-padding ads-banner"><imgclass="img-fluid"src="theme/img/banner-ad.jpg"alt=""></div></div></div></div><divclass="container main-menu"id="main-menu"><divclass="row align-items-center justify-content-between"><navid="nav-menu-container"><ulclass="nav-menu"><liclass="menu-active"><ahref="index.html">Home</a></li><li><ahref="archive.html">Archive</a></li><li><ahref="category.html">Category</a></li><liclass="menu-has-children"><ahref="">Post Types</a><ul><li><ahref="standard-post.html">Standard Post</a></li><li><ahref="image-post.html">Image Post</a></li><li><ahref="gallery-post.html">Gallery Post</a></li><li><ahref="video-post.html">Video Post</a></li><li><ahref="audio-post.html">Audio Post</a></li></ul></li><li><ahref="about.html">About</a></li><li><ahref="contact.html">Contact</a></li></ul></nav><!-- #nav-menu-container --><divclass="navbar-right"><formclass="Search"><inputtype="text"class="form-control Search-box"name="Search-box"id="Search-box"placeholder="Search"><labelfor="Search-box"class="Search-box-label"><spanclass="lnr lnr-magnifier"></span></label><spanclass="Search-close"><spanclass="lnr lnr-cross"></span></span></form></div></div></div></header><!-- start footer Area --><footerclass="footer-area section-gap"><divclass="container"><divclass="row"><divclass="col-lg-3 col-md-6 single-footer-widget"><h4>Top Products</h4><ul><li><ahref="#">Managed Website</a></li><li><ahref="#">Manage Reputation</a></li><li><ahref="#">Power Tools</a></li><li><ahref="#">Marketing Service</a></li></ul></div><divclass="col-lg-2 col-md-6 single-footer-widget"><h4>Quick Links</h4><ul><li><ahref="#">Jobs</a></li><li><ahref="#">Brand Assets</a></li><li><ahref="#">Investor Relations</a></li><li><ahref="#">Terms of Service</a></li></ul></div><divclass="col-lg-2 col-md-6 single-footer-widget"><h4>Features</h4><ul><li><ahref="#">Jobs</a></li><li><ahref="#">Brand Assets</a></li><li><ahref="#">Investor Relations</a></li><li><ahref="#">Terms of Service</a></li></ul></div><divclass="col-lg-2 col-md-6 single-footer-widget"><h4>Resources</h4><ul><li><ahref="#">Guides</a></li><li><ahref="#">Research</a></li><li><ahref="#">Experts</a></li><li><ahref="#">Agencies</a></li></ul></div><divclass="col-lg-3 col-md-6 single-footer-widget"><h4>Instragram Feed</h4><ulclass="instafeed d-flex flex-wrap"><li><imgsrc="theme/img/i1.jpg"alt=""></li><li><imgsrc="theme/img/i2.jpg"alt=""></li><li><imgsrc="theme/img/i3.jpg"alt=""></li><li><imgsrc="theme/img/i4.jpg"alt=""></li><li><imgsrc="theme/img/i5.jpg"alt=""></li><li><imgsrc="theme/img/i6.jpg"alt=""></li><li><imgsrc="theme/img/i7.jpg"alt=""></li><li><imgsrc="theme/img/i8.jpg"alt=""></li></ul></div></div><divclass="footer-bottom row align-items-center"><pclass="footer-text m-0 col-lg-8 col-md-12"><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --> Copyright ©<script>document.write(newDate().getFullYear());</script> All rights reserved | This template is made with <iclass="fa fa-heart-o"aria-hidden="true"></i> by <ahref="https://colorlib.com"target="_blank">Colorlib</a><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></p><divclass="col-lg-4 col-md-12 footer-social"><ahref="#"><iclass="fa fa-facebook"></i></a><ahref="#"><iclass="fa fa-twitter"></i></a><ahref="#"><iclass="fa fa-dribbble"></i></a><ahref="#"><iclass="fa fa-behance"></i></a></div></div></div></footer><!-- End footer Area --><script src="theme/js/vendor/jquery-2.2.4.min.js"></script><script src="theme/https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"crossorigin="anonymous"></script><script src="theme/js/vendor/bootstrap.min.js"></script><script src="theme/https://maps.googleapis.com/maps/api/js?key=AIzaSyBhOdIF3Y9382fqJYt5I_sswSrEw5eihAA"></script><script src="theme/js/easing.min.js"></script><script src="theme/js/hoverIntent.js"></script><script src="theme/js/superfish.min.js"></script><script src="theme/js/jquery.ajaxchimp.min.js"></script><script src="theme/js/jquery.magnific-popup.min.js"></script><script src="theme/js/mn-accordion.js"></script><script src="theme/js/jquery-ui.js"></script><script src="theme/js/jquery.nice-select.min.js"></script><script src="theme/js/owl.carousel.min.js"></script><script src="theme/js/mail-script.js"></script><script src="theme/js/main.js"></script></body></html> |
All done! see you in the next lesson