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>
<html lang="zxx" class="no-js">
    <head>
        <!-- Mobile Specific Meta -->
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <!-- Favicon-->
        <link rel="shortcut icon" href="img/fav.png">
        <!-- Author Meta -->
        <meta name="author" content="colorlib">
        <!-- Meta Description -->
        <meta name="description" content="">
        <!-- Meta Keyword -->
        <meta name="keywords" content="">
        <!-- meta character set -->
        <meta charset="UTF-8">
        <!-- Site Title -->
        <title>Magazine</title>
        <link href="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700" rel="stylesheet">
        <!--
       CSS
       ============================================= -->
        <link rel="stylesheet" href="theme/css/linearicons.css">
        <link rel="stylesheet" href="theme/css/font-awesome.min.css">
        <link rel="stylesheet" href="theme/css/bootstrap.css">
        <link rel="stylesheet" href="theme/css/magnific-popup.css">
        <link rel="stylesheet" href="theme/css/nice-select.css">
        <link rel="stylesheet" href="theme/css/animate.min.css">
        <link rel="stylesheet" href="theme/css/owl.carousel.css">
        <link rel="stylesheet" href="theme/css/jquery-ui.css">
        <link rel="stylesheet" href="theme/css/main.css">
    </head>
    <body>
        <header>
            
            <div class="logo-wrap">
                <div class="container">
                    <div class="row justify-content-between align-items-center">
                        <div class="col-lg-4 col-md-4 col-sm-12 logo-left no-padding">
                            <a href="index.html">
                                <img class="img-fluid" src="theme/img/logo.png" alt="">
                            </a>
                        </div>
                        <div class="col-lg-8 col-md-8 col-sm-12 logo-right no-padding ads-banner">
                            <img class="img-fluid" src="theme/img/banner-ad.jpg" alt="">
                        </div>
                    </div>
                </div>
            </div>
            <div class="container main-menu" id="main-menu">
                <div class="row align-items-center justify-content-between">
                    <nav id="nav-menu-container">
                        <ul class="nav-menu">
                            <li class="menu-active"><a href="index.html">Home</a></li>
                            <li><a href="archive.html">Archive</a></li>
                            <li><a href="category.html">Category</a></li>
                            <li class="menu-has-children"><a href="">Post Types</a>
                            <ul>
                                <li><a href="standard-post.html">Standard Post</a></li>
                                <li><a href="image-post.html">Image Post</a></li>
                                <li><a href="gallery-post.html">Gallery Post</a></li>
                                <li><a href="video-post.html">Video Post</a></li>
                                <li><a href="audio-post.html">Audio Post</a></li>
                            </ul>
                        </li>
                        <li><a href="about.html">About</a></li>
                        <li><a href="contact.html">Contact</a></li>
                    </ul>
                    </nav><!-- #nav-menu-container -->
                    <div class="navbar-right">
                        <form class="Search">
                            <input type="text" class="form-control Search-box" name="Search-box" id="Search-box" placeholder="Search">
                            <label for="Search-box" class="Search-box-label">
                                <span class="lnr lnr-magnifier"></span>
                            </label>
                            <span class="Search-close">
                                <span class="lnr lnr-cross"></span>
                            </span>
                        </form>
                    </div>
                </div>
            </div>
        </header>






<!-- start footer Area -->
        <footer class="footer-area section-gap">
            <div class="container">
                <div class="row">
                    <div class="col-lg-3 col-md-6 single-footer-widget">
                        <h4>Top Products</h4>
                        <ul>
                            <li><a href="#">Managed Website</a></li>
                            <li><a href="#">Manage Reputation</a></li>
                            <li><a href="#">Power Tools</a></li>
                            <li><a href="#">Marketing Service</a></li>
                        </ul>
                    </div>
                    <div class="col-lg-2 col-md-6 single-footer-widget">
                        <h4>Quick Links</h4>
                        <ul>
                            <li><a href="#">Jobs</a></li>
                            <li><a href="#">Brand Assets</a></li>
                            <li><a href="#">Investor Relations</a></li>
                            <li><a href="#">Terms of Service</a></li>
                        </ul>
                    </div>
                    <div class="col-lg-2 col-md-6 single-footer-widget">
                        <h4>Features</h4>
                        <ul>
                            <li><a href="#">Jobs</a></li>
                            <li><a href="#">Brand Assets</a></li>
                            <li><a href="#">Investor Relations</a></li>
                            <li><a href="#">Terms of Service</a></li>
                        </ul>
                    </div>
                    <div class="col-lg-2 col-md-6 single-footer-widget">
                        <h4>Resources</h4>
                        <ul>
                            <li><a href="#">Guides</a></li>
                            <li><a href="#">Research</a></li>
                            <li><a href="#">Experts</a></li>
                            <li><a href="#">Agencies</a></li>
                        </ul>
                    </div>
                    <div class="col-lg-3 col-md-6 single-footer-widget">
                        <h4>Instragram Feed</h4>
                        <ul class="instafeed d-flex flex-wrap">
                            <li><img src="theme/img/i1.jpg" alt=""></li>
                            <li><img src="theme/img/i2.jpg" alt=""></li>
                            <li><img src="theme/img/i3.jpg" alt=""></li>
                            <li><img src="theme/img/i4.jpg" alt=""></li>
                            <li><img src="theme/img/i5.jpg" alt=""></li>
                            <li><img src="theme/img/i6.jpg" alt=""></li>
                            <li><img src="theme/img/i7.jpg" alt=""></li>
                            <li><img src="theme/img/i8.jpg" alt=""></li>
                        </ul>
                    </div>
                </div>
                <div class="footer-bottom row align-items-center">
                    <p class="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 &copy;<script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></p>
                    <div class="col-lg-4 col-md-12 footer-social">
                        <a href="#"><i class="fa fa-facebook"></i></a>
                        <a href="#"><i class="fa fa-twitter"></i></a>
                        <a href="#"><i class="fa fa-dribbble"></i></a>
                        <a href="#"><i class="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