-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeed.xml
More file actions
291 lines (207 loc) · 31.4 KB
/
Copy pathfeed.xml
File metadata and controls
291 lines (207 loc) · 31.4 KB
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.2">Jekyll</generator><link href="https://ai4science101.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://ai4science101.github.io/" rel="alternate" type="text/html" /><updated>2025-09-18T21:27:01-07:00</updated><id>https://ai4science101.github.io/feed.xml</id><title type="html">AI4Science101</title><subtitle>AI for Science 101
</subtitle><entry><title type="html">Introducing some new layouts to Bulma Clean Theme</title><link href="https://ai4science101.github.io/2019/07/23/introducing-some-new-layouts-to-bulma-clean-theme/" rel="alternate" type="text/html" title="Introducing some new layouts to Bulma Clean Theme" /><published>2019-07-23T01:00:07-07:00</published><updated>2019-07-23T01:00:07-07:00</updated><id>https://ai4science101.github.io/2019/07/23/introducing-some-new-layouts-to-bulma-clean-theme</id><content type="html" xml:base="https://ai4science101.github.io/2019/07/23/introducing-some-new-layouts-to-bulma-clean-theme/"><![CDATA[<p>I’ve been meaning to write about some of the new features I have been rolling out to my Jekyll theme, <a href="https://www.csrhymes.com/bulma-clean-theme/">Bulma Clean Theme</a>, for a while but I have only just managed to push the update for the landing page layout last weekend. This article provides some of the thinking behind the updates, as well as a brief introduction to how to get started.</p>
<h2 id="product-pages">Product Pages</h2>
<p>I use the theme to power my own personal website and decided that it would be good to update my <a href="https://www.csrhymes.com/books">book pages</a>, or book page as it was then. The page had used a very simple layout with both books on one page and was not really up to scratch. I decided it would be better to make each book its own page, and if I ever get round to it and write another book it would be easy to add another to the site in the future. Rather than just building these pages for my own site, I thought it would be a nice addition to the base theme.</p>
<p>I really like Jekyll as it is simple to use, but also very powerful. I decided to make the most of the frontmatter and allow you to set most of the product information in there, leaving the main content of the page for the text description.</p>
<p>To get started, create your product pages inside a <code class="language-plaintext highlighter-rouge">_products</code> directory as we will make use of collections later on.</p>
<p>The below is an example of the frontmatter for the product page. The product page uses the same hero, title and subtitle settings as other pages, but has additional settings for product code, image, price, rating and features. The product code is important for later on.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Product 1 Name</span>
<span class="na">subtitle</span><span class="pi">:</span> <span class="s">Product 1 tagline here</span>
<span class="na">description</span><span class="pi">:</span> <span class="s">This is a product description</span>
<span class="na">hero_image</span><span class="pi">:</span> <span class="s">/img/hero-img.jpg</span>
<span class="na">product_code</span><span class="pi">:</span> <span class="s">ABC124</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">product</span>
<span class="na">image</span><span class="pi">:</span> <span class="s">https://via.placeholder.com/640x480</span>
<span class="na">price</span><span class="pi">:</span> <span class="s">£1.99 + VAT</span>
<span class="na">features</span><span class="pi">:</span>
<span class="pi">-</span> <span class="na">label</span><span class="pi">:</span> <span class="s">Great addition to any home</span>
<span class="na">icon</span><span class="pi">:</span> <span class="s">fa-location-arrow</span>
<span class="pi">-</span> <span class="na">label</span><span class="pi">:</span> <span class="s">Comes in a range of styles</span>
<span class="na">icon</span><span class="pi">:</span> <span class="s">fa-grin-stars</span>
<span class="pi">-</span> <span class="na">label</span><span class="pi">:</span> <span class="s">Available in multiple sizes</span>
<span class="na">icon</span><span class="pi">:</span> <span class="s">fa-fighter-jet</span>
<span class="na">rating</span><span class="pi">:</span> <span class="m">3</span>
<span class="nn">---</span>
</code></pre></div></div>
<p>The features provides a way of making a bullet point list of the key product features, but instead of plain disc bullet points you can use font awesome icons to make it a bit more interesting.</p>
<p>I don’t know about you, but sometimes I spend longer deciding on what icon to use than making the rest of the page.</p>
<p>I’ve deliberately made the product pages have a 4 by 3 image ratio as I feel it works best across different screen sizes. Like all themes, if you want to change it you can override the default layouts if you want a different ratio.</p>
<p>Once you have created your product pages, you will need to tell Jekyll to output them. This is done by adding collections settings in the <code class="language-plaintext highlighter-rouge">_config.yml</code> for your site.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">collections</span><span class="pi">:</span>
<span class="na">products</span><span class="pi">:</span>
<span class="na">output</span><span class="pi">:</span> <span class="no">true</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">product</span>
<span class="na">image</span><span class="pi">:</span> <span class="s">https://via.placeholder.com/800x600</span>
<span class="na">show_sidebar</span><span class="pi">:</span> <span class="no">false</span>
</code></pre></div></div>
<p>Now when you run jekyll build it will output a load of product pages for you, now we just need a way of getting to them. This is where the product category page comes in.</p>
<h2 id="product-category">Product Category</h2>
<p>Create a page, such as products.md or in my case books.md and set it to use the product-category layout. This will generate a list of the products, but you can also add some introduction content in the main content section of the page if you so desire.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Products</span>
<span class="na">subtitle</span><span class="pi">:</span> <span class="s">Check out our range of products</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">product-category</span>
<span class="na">show_sidebar</span><span class="pi">:</span> <span class="no">false</span>
<span class="na">sort</span><span class="pi">:</span> <span class="s">title</span>
<span class="nn">---</span>
<span class="s">This is some page content and it will appear above the product list.</span>
</code></pre></div></div>
<h2 id="product-reviews">Product Reviews</h2>
<p>The last addition to the product pages is reviews. If you would like to list some customer reviews on your product pages, then you will need to create a reviews directory inside _data and create a separate file for each product with reviews, named after the product code. For example <code class="language-plaintext highlighter-rouge">_data/reviews/ABC124.yml</code></p>
<p>The data file should follow the below format. The name is the customer name, the rating is how many stars out of 5, the title is the main title of the review and the avatar is a link to an image, if you have one. If you don’t have a customer image then just omit it and a user icon will be used instead. Lastly, the description is the main content of the review.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Mr E Xample</span>
<span class="na">rating</span><span class="pi">:</span> <span class="m">4</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Great product, highly recommended</span>
<span class="na">date</span><span class="pi">:</span> <span class="s">01/01/2019</span>
<span class="na">avatar</span><span class="pi">:</span> <span class="s">https://bulma.io/images/placeholders/128x128.png</span>
<span class="na">description</span><span class="pi">:</span> <span class="pi">></span>
<span class="s">The product worked really well. I would recommend this to most people to use. Delivery was quick and reasonable. </span>
<span class="s">Would recommend this to my friends. </span>
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Mrs R E View</span>
<span class="na">rating</span><span class="pi">:</span> <span class="m">5</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Nice, really liked this</span>
<span class="na">date</span><span class="pi">:</span> <span class="s">02/02/2019</span>
<span class="na">description</span><span class="pi">:</span> <span class="pi">></span>
<span class="s">The product worked exactly as described.</span>
</code></pre></div></div>
<p>Example <a href="https://www.csrhymes.com/bulma-clean-theme/products/">product category and product pages</a> can be seen on the theme’s demo site here if you want to take a look.</p>
<h2 id="landing-page-layout">Landing Page Layout</h2>
<p>I was thinking it would be good to create a landing style page so I could highlight a new project or something I was working on separately from the main projects page already on my site. Rather than create a new layout I thought it would be better to enhance the existing page layout so you could choose to use these features if you so desired.</p>
<p>I started by adding a call to action (otherwise known as a large button) in the hero at the top of the page. This can be used by adding hero_link and hero_link_text to the frontmatter.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">page</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Example Landing Page</span>
<span class="na">subtitle</span><span class="pi">:</span> <span class="s">This is an example landing page with callouts</span>
<span class="na">hero_height</span><span class="pi">:</span> <span class="s">is-large</span>
<span class="na">hero_link</span><span class="pi">:</span> <span class="s">/page-1/</span>
<span class="na">hero_link_text</span><span class="pi">:</span> <span class="s">Example Call To Action</span>
<span class="nn">---</span>
</code></pre></div></div>
<p>Next, I wanted to make some nice callouts to help shout about key features of whatever you are talking about on your landing page. This started out as a simple icon and a title, but slowly evolved to allow for a subtitle, description text and a call to action button as well.</p>
<p>To make it more flexible, only the title and subtitle are required and the rest can be used as and when necessary.</p>
<p>To make the callouts reusable in different pages on your site, the content is defined in a datafile, for example, example_callouts.yml. The below shows the example structure for the callouts.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">style</span><span class="pi">:</span> <span class="s">is-light</span>
<span class="na">items</span><span class="pi">:</span>
<span class="pi">-</span> <span class="na">title</span><span class="pi">:</span> <span class="s">Example callout </span><span class="m">1</span>
<span class="na">subtitle</span><span class="pi">:</span> <span class="s">Example subtitle </span><span class="m">1</span>
<span class="na">icon</span><span class="pi">:</span> <span class="s">fa-space-shuttle</span>
<span class="na">description</span><span class="pi">:</span> <span class="pi">></span>
<span class="s">The example description text goes here and can be multiple lines.</span>
<span class="s">For example, such as this. </span>
<span class="na">call_to_action_name</span><span class="pi">:</span> <span class="s">Call to action </span><span class="m">1</span>
<span class="na">call_to_action_link</span><span class="pi">:</span> <span class="s">/page-1/</span>
</code></pre></div></div>
<p>The style is the style of the hero that the callouts are contained in. This makes use of Bulma hero styles.</p>
<p>Then to display the callouts on the page, add a callouts setting to the pages frontmatter with the name of the data file without the extension.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">page</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Example Landing Page</span>
<span class="na">subtitle</span><span class="pi">:</span> <span class="s">This is an example landing page</span>
<span class="na">callouts</span><span class="pi">:</span> <span class="s">example_callouts</span>
<span class="nn">---</span>
</code></pre></div></div>
<p>An example <a href="https://www.csrhymes.com/bulma-clean-theme/landing/">landing page layout</a> can be seen in the theme’s demo site.</p>
<h2 id="what-do-you-think">What do you think?</h2>
<p>I’ve tried to make these additions easy to use and flexible where possible. I’ve updated the readme file and the theme demo site with more information to help you get started with these new features.</p>
<p>If you decide to give the theme a go, it would be great to see how you are using it and if you have any ideas of how it can be developed further. You never know, if I get enough responses then I may even make a showcase page on the demo theme site to highlight how others are using it.</p>]]></content><author><name>C.S. Rhymes</name></author><category term="webdev" /><category term="showdev" /><category term="webdesign" /><summary type="html"><![CDATA[Introducing Product Pages and Landing Pages for Bulma Clean Theme]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://www.csrhymes.com/img/landing-page.jpg" /><media:content medium="image" url="https://www.csrhymes.com/img/landing-page.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Getting started with Bulma Clean Theme for Jekyll</title><link href="https://ai4science101.github.io/development/2019/02/09/getting-started-with-bulma-clean-theme/" rel="alternate" type="text/html" title="Getting started with Bulma Clean Theme for Jekyll" /><published>2019-02-09T12:00:07-08:00</published><updated>2019-02-09T12:00:07-08:00</updated><id>https://ai4science101.github.io/development/2019/02/09/getting-started-with-bulma-clean-theme</id><content type="html" xml:base="https://ai4science101.github.io/development/2019/02/09/getting-started-with-bulma-clean-theme/"><![CDATA[<p>I have made a <a href="https://rubygems.org/gems/bulma-clean-theme">theme for Jekyll</a> which is based on the Bulma frontend framework. It might look familiar, because I am also using it for this site. If you like the look of this theme then I thought I would write a little blog post about how to use it for your own site and how you can use it with GitHub Pages.</p>
<h2 id="getting-started">Getting started</h2>
<p>First things first, you need a local instance of Jekyll running on your computer. I’m assuming you are familiar with Jekyll and have everything you need installed. If this is not the case, check out the documentation on the <a href="https://jekyllrb.com/docs/">Jekyll website</a>. For this example, lets call the site myblog.</p>
<p>Create a new installation of Jekyll, then go into the myblog directory:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jekyll new myblog
<span class="nb">cd </span>myblog
</code></pre></div></div>
<p>Then add the theme to the Gemfile:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gem "bulma-clean-theme"
</code></pre></div></div>
<p>Then add the theme to your _config.yml:</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">theme</span><span class="pi">:</span> <span class="s">bulma-clean-theme</span>
</code></pre></div></div>
<p>Then run bundle to install everything</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bundle
</code></pre></div></div>
<p>You can then preview your site by running the usual command</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bundle <span class="nb">exec </span>jekyll serve
</code></pre></div></div>
<h2 id="creating-pages">Creating pages</h2>
<p>A page can either be a html or a markdown file, as long as you set the frontmatter. There are a few settings that pages can use to customise the default theme a bit further if you so choose.</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">page</span>
<span class="na">title</span><span class="pi">:</span> <span class="s">Page Title</span>
<span class="na">subtitle</span><span class="pi">:</span> <span class="s">Page Subtitle</span>
<span class="na">image</span><span class="pi">:</span> <span class="s">/path/to/image.jpg</span>
<span class="na">description</span><span class="pi">:</span> <span class="s">The pages meta description</span>
<span class="na">hero_image</span><span class="pi">:</span> <span class="s">/path/to/hero-image.jpg</span>
<span class="na">hero_height</span><span class="pi">:</span> <span class="s">is-fullheight</span>
<span class="nn">---</span>
</code></pre></div></div>
<p>If you don’t set a subtitle, image, hero_image or hero_height then defaults will be used or in the case of the hero_image, no image will be used on the hero.</p>
<p>The theme uses the jekyll-seo-tag plugin so it will use the information you provide in the frontmatter to auto populate the meta tags and open graph tags.</p>
<h2 id="posts">Posts</h2>
<p>Posts are created as per the standard Jekyll method, in a _posts directory, with each post named YYYY-MM-DD-name-of-post.markdown. For the post frontmatter you can use the same settings as a page, except you need to change the layout to post and add date and author settings.</p>
<h2 id="blog-page">Blog page</h2>
<p>For the blog homepage, create a blog.html page with <code class="language-plaintext highlighter-rouge">layout: blog</code> and use the other settings from a normal page. The theme is set up to use jekyll-paginate so you just need to add pagination options to your _config.yml</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Pagination settings</span>
<span class="na">paginate</span><span class="pi">:</span> <span class="m">5</span>
<span class="na">paginate_path</span><span class="pi">:</span> <span class="s2">"</span><span class="s">/blog/page:num"</span>
</code></pre></div></div>
<h2 id="site-defaults">Site defaults</h2>
<p>If you don’t want to set each hero_image individually, then you can set default values in your _config.yml. The below example sets a default author, layout and hero image for every post. It also turns on the side bar on the right of post pages, which will display links to your latest posts.</p>
<div class="language-yml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">defaults</span><span class="pi">:</span>
<span class="pi">-</span>
<span class="na">scope</span><span class="pi">:</span>
<span class="na">path</span><span class="pi">:</span> <span class="s2">"</span><span class="s">"</span>
<span class="na">type</span><span class="pi">:</span> <span class="s2">"</span><span class="s">posts"</span>
<span class="na">values</span><span class="pi">:</span>
<span class="na">author</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Author</span><span class="nv"> </span><span class="s">Name"</span>
<span class="na">layout</span><span class="pi">:</span> <span class="s">post</span>
<span class="na">hero_image</span><span class="pi">:</span> <span class="s">/path/to/hero-image.jpg</span>
<span class="na">show_sidebar</span><span class="pi">:</span> <span class="no">true</span>
</code></pre></div></div>
<h2 id="styles">Styles</h2>
<p>The theme uses Bulma frontend framework which provides a wide range of sass variable customisations. If you want to overwrite any of the standard variables, such as the primary theme colour, then set a sass variable in a new file in assets/css/app.scss before importing the main stylesheet.</p>
<div class="language-scss highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">---</span><span class="err">
</span><span class="na">---</span><span class="err">
$</span><span class="na">primary</span><span class="p">:</span> <span class="mh">#333333</span><span class="p">;</span>
<span class="c1">// Import Main CSS file from theme</span>
<span class="k">@import</span> <span class="s2">"main"</span><span class="p">;</span>
</code></pre></div></div>
<p>You can also add any of your own custom css to this file if you want to.</p>
<h3 id="navigation">Navigation</h3>
<p>Once you have created posts and pages, you will need to create a way for visitors to access them. The theme makes use of the Bulma navbar, which is configured through a simple yaml file. All you need to do is create a navigation.yml file in <code class="language-plaintext highlighter-rouge">_data</code> directory with the following format with the pages you want to include in the top navigation. You can now also add items to a dropdown menu.</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Page </span><span class="m">1</span>
<span class="na">link</span><span class="pi">:</span> <span class="s">page-1</span>
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Blog</span>
<span class="na">link</span><span class="pi">:</span> <span class="s">blog</span>
<span class="na">dropdown</span><span class="pi">:</span>
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Page </span><span class="m">2</span>
<span class="na">link</span><span class="pi">:</span> <span class="s">page-2</span>
</code></pre></div></div>
<p>Bulma is pretty handy in the way it converts the same HTML into a mobile / tablet friendly navigation, so you only need to set the menu up once for all screen sizes.</p>
<h2 id="using-bulma-clean-theme-with-github-pages">Using bulma-clean-theme with Github Pages</h2>
<p>For the site to work with Github Pages, all you need to do is update the _config.yml so it uses remote_theme instead of theme and update it to chrisrhymes/bulma-clean-theme so it knows which GitHub repo to pull the theme from when it builds your site.</p>
<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#theme: bulma-clean-theme</span>
<span class="na">remote_theme</span><span class="pi">:</span> <span class="s">chrisrhymes/bulma-clean-theme</span>
</code></pre></div></div>
<p>And then push up your changes to Github as normal.</p>
<p>There seems to be an issue where Jekyll doesn’t work locally with remote_theme, so when working locally you have to add theme back in, but remember to comment theme out again before pushing back up to GitHub or you will probably get a build warning email.</p>
<h2 id="i-hope-your-not-feeling-overwhelmed">I hope your not feeling overwhelmed</h2>
<p>It may seem like there is a lot to do to get started, but really it shouldn’t take very long to get a site up and running. All the options are there just in case you want to further customise the theme to be more personal to you, but you can just use the basic minimal settings to get yourself up and running.</p>
<h2 id="feedback-and-issues">Feedback and Issues</h2>
<p>If you have any feedback, ideas or issues with how the theme could be improved, then please create an issue on the theme’s GitHub page and I will try and take a look into it as soon as I can. The theme is still quite new and I have quite a few ideas for future enhancements, so I will write a new blog post on this site when any new features become available.</p>]]></content><author><name>C.S. Rhymes</name></author><category term="development" /><summary type="html"><![CDATA[Getting started with Bulma Clean Theme for Jekyll and using it with GitHub Pages]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://www.csrhymes.com/img/bulma-clean-theme.jpg" /><media:content medium="image" url="https://www.csrhymes.com/img/bulma-clean-theme.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Why use a static site generator</title><link href="https://ai4science101.github.io/development/2018/05/28/why-use-a-static-site-generator/" rel="alternate" type="text/html" title="Why use a static site generator" /><published>2018-05-28T03:50:07-07:00</published><updated>2018-05-28T03:50:07-07:00</updated><id>https://ai4science101.github.io/development/2018/05/28/why-use-a-static-site-generator</id><content type="html" xml:base="https://ai4science101.github.io/development/2018/05/28/why-use-a-static-site-generator/"><![CDATA[<p>There are many ways to make a website and many different CMS platforms you can use, such as WordPress and Joomla, as well as site builder tools that offer you drag and drop interfaces, but what about static site generators?</p>
<p>A static site is pretty much what it sounds like, a set of pre generated html pages. Other platforms take what you enter into the CMS and process the information stored in the database, alongside a template or many template partials and dynamically construct the page before serving the html to you in your browser.</p>
<h2 id="speed">Speed</h2>
<p>The initial advantage of a static site over a dynamic, database driven site is the page speed as means a lot less processing has to be done before the page is delivered. Some CMS’s provide caching which means that the first visitor to the page gets a dynamic version and then stores a cache of the page. This means subsequent visitor to the page gets the page quicker than the first. If you have a regularly cleared cache, or low numbers of visitors, subsequent visitors may not benefit from the caching and would all experience the increased load times.</p>
<h2 id="version-control">Version Control</h2>
<p>The next advantage of a static site is that it is that it can be version controlled. Usually a CMS relies on a database, which means that if you delete a page or some page content you either have to have revisions enabled in your CMS so you can roll back to a previous version or you need regular backups of your database so you can roll that back to a previous version. A static site with version control means you can easily revert to a previous version of your site and content without the need for database manipulation.</p>
<h2 id="data-files">Data Files</h2>
<p>Static sites, such as Jekyll, also offer a way of storing data in a more human readable format, such as yaml or JSON. This means you can store data that is used in multiple places across your site in one file and reference it in many places. For example, you may have a data file containing products, which you want to list in a category page and a product details page and maybe feature it on the homepage as well. These files can also be version controlled, meaning any changes or updates to your datafiles can be undone easily. The files can also be easily edited in a text editor so if you need to make multiple product amends, such as updating a misspelt brand name you can use something as simple as find and replace to update the spelling in all places at once without having to navigate to multiple different pages in a CMS.</p>
<h2 id="design-freedom">Design Freedom</h2>
<p>The biggest benefit I find to a static site is there is more freedom for a frontend developer and how they design and build your site. Some CMS’s work in a particular way and you are limited by the way they work. Page builders are available for many CMS’s but it often results in a lot of effort to get a particular piece of content in a particular place on the page.</p>
<p>A static site generator gives you more freedom to write your own html and text onto the page in the format you want it, rather than having to customise or overwrite the html and css classes output by the page builder tool.</p>
<h2 id="data-protection">Data Protection</h2>
<p>A lot of people like the idea of installing a plugin into a CMS to handle things such as contact forms, so people can contact you about something, but in all honesty, it’s easier just to have an email address on the page that users can click on and email you directly. The reason I say this is that you have to try and prevent spam emails by using some kind of captcha on the form, as well as maintaining an email service that will handle the form submission and either store the form data somewhere on your site or send it to you as an email. This is pretty basic stuff, but is further complicated by data privacy laws that dictate how you store customers data and how you protect it. I know a lot of small business users would prefer to not have the hassle of managing stored user data on their site.</p>
<h2 id="security">Security</h2>
<p>One last thing to consider is website security. There is always a chance that using a popular CMS will leave your site vulnerable as there are always security issues being identified. You need to constantly keep your site up to date and lock down the CMS login as secure as possible. With a static site, there is no login screen. The original content lives somewhere else and the compiled, generated html is all that needs to be uploaded to your website, minimising the risk. Any public facing website has some risk but anything you can do to minimise it is better for your website in the long run.</p>
<h2 id="what-will-you-use-on-your-next-project">What will you use on your next project?</h2>
<p>A static site may not be the first thing you consider when building your new website, but it’s definitely worth exploring the pros and cons before you start the next project. After all, a faster, more secure site is better for you and your visitors.</p>]]></content><author><name>C.S. Rhymes</name></author><category term="development" /><summary type="html"><![CDATA[There are many ways to make a website, but what about static site generators]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://www.csrhymes.com//img/static-site-generator.jpg" /><media:content medium="image" url="https://www.csrhymes.com//img/static-site-generator.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>