🏠 πŸ—’οΈ πŸ‡«πŸ‡·

Why a static website with Hugo?

Static pros are better!

Fast 🏎️

Visitors don’t have to wait on the servers while it builds the HTML file on the fly.
The file has been there all along, ready to serve!

As a result, loading speed is super fast even on low bandwidth!

Safe πŸ”

No Database. No SQL injection. No potentially exposed data is stored anywhere but on in your core files.

There’s only one gate to keep, your file server. πŸ§™

Reliable πŸ’ͺ

A static website does not need any work from server beside serving HTML and media files. It’s pretty much like serving a bunch of tiny pictures everytime a visitor lands on the site.

No risk of the sever slowing down or heating up during peak traffic.

Bye bye Error 501!

A visit walkthrough…

WordPress or any classic dynamic website

  1. Visitor lands on the page
  2. File Server connects to database
  3. Database server returns the required data
  4. File serveur uses the retrieved data to build an HTML file on the fly.
  5. Vistor’s browser downloads the HTML file and put it on screen.

Static site

  1. Visitor lands on the page
  2. Vistor’s browser downloads the HTML file and put it on screen.

CMS Solution ✏️

A database free CMS? Yes can do!

Forestry

Forestry.io is a Canadian company (πŸ‡¨πŸ‡¦β£οΈ) which offers a reliable CMS solution for static website!

πŸ‘‰ Forestry.io Demo

  1. Add/Edit page
  2. Add a media
  3. Add blocks
  4. Preview unpublished changes
  5. Shortcode/Snippet

Why Hugo rather than other static gen out there?

Hugo is in the top three Static Site Genrators1, and easily wins ranks number one in velocity πŸ₯‡.

Build speed

A static generator must be able to build every HTML pages the instant the content is edited.
If you intend on updating the content often, then the build speed becomes undeniably very critical.

Hugo can build 10,000 pages in less than 10 seconds 😱

Gimme facts! πŸ“ˆ23

StatGen1,00010,000
Hugo πŸš€0.65s7.46s
Gatsby πŸƒ7.4s74s (> 1 minute)
Jekyll 🐌18.42s218s (> 3 minutes)

Think about that for your editors πŸ€”

Within the 5 long seconds it usually takes WordPress to reload the page after hitting “save”, Hugo will have rebuilt the website and deployed the thousands newly generated files live! And all of that while allowing the editor to keep on queuing new changes!

Or… you could just programmatically set automatic builds every 5 minutes without a sweat.

You don’t need 1000 posts or pages in your content to end up with 1000 HTML files. An average numbers of categories, assigned to an average number of posts and your StaticGen will need to build many category archives, with several pages each (Page 1, Page 2 etc…)

Technically… How does that work? πŸ€“

Any editor be through a CMS like Forestry.io or directly from within a content file edit a page of the website.

This update will trigger a build or compilation of the the HTML files from Hugo.

During the build, Hugo will read every Markdown files from the content directory and generate the HTML files using their data.

Content Directory structure example

└── content
    β”œβ”€β”€ about.md
    β”œβ”€β”€ contact.md
    β”œβ”€β”€ team.md
    β”œβ”€β”€ posts
    β”‚   β”œβ”€β”€ a-new-initiative.md
    β”‚   └── speaker-intro.md
    └── projects
	      β”œβ”€β”€ city-museum.md
	      └── warehouse-redesign.md

Markdown file example:

πŸ‘‡ Let’s look at a simple Markdown file:

---
title: Une nouvelle initiative
date: 2018-08-07
image: intitiatve.jpg
categories:
- Entreprise
- Solutions
---

## La nouvelle initiative en question

Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus. Aenean lacinia bibendum nulla sed consectetur. Sed posuere consectetur est at lobortis.

1. DΓ©buter
2. Continuer
3. Perseverer

## Conclusion

Pour en savoir plus [c'est par lΓ ](https://liens-utiles.org)

πŸ‘‰ We can also at the Mardkdown code from this very page here.

⏫