Hugo Magnolia πΈ | Demo
A simple, customizable, multilingual Hugo theme thought for professionals and small businesses.
I decided to give my personal thank you to the Hugo developers and community by making this theme available for everyone.
This theme is actually very "hugo noob" friendly, as it provides an example site to be used with the latest version of the theme, the main pages are there to be used as they are, with most of the params already in the config files. you can customize the color palette and some of the pages images. This theme also aims to be very well documented in order to be accessible even from a complete stranger and make your site run asap.
I strongly value the open source community as in these years i've been using many open source projects that made my life better and improved my digital freedom in many ways.
Freedom makes us better humans, and makes us improve our status faster and in an easier way.
Make sure to star this repo!
I built this theme with simplicity in mind, it is small and easily customizable, responsive, modular and multilingual. But it also leaves some space to further in-depth customization since it uses Bootstrap and SCSS. This theme is thought to be used as a personal / business theme, it can provide a great landing page or blog for your activity!
- The theme is fully responsive and shows perfectly on every screen size.
- Hide and show some elements easily from the config file.
- The default content language is english (it can be changed), but you can add as many languages as you want very easily, the theme includes an italian language example and a dropdown menΓΉ for easily switching between languages. Permalinks can be localized in each language (eg. you can have
/contacts
for english and/contatti
for italian).
These are the currently customizable sections:
- Landing page
- "Services" page with arbitrary number of points
- "Office" page with integrated google maps view for directions
- Contacts page with FormSpree connected form and opening hours
- Every page has an easily customizable meta description and a unique meta title for better and easier indexing. Each post has the option of adding a featured image, and, if not found,
assets/img/meta-image
will be used instead as meta image for Google, Facebook and Twitter. All pages that do not have a featured image will have themeta-image
by default (eg. homepage, office etc). There is arobots.txt
file which indicates the correct location of the sitemap index for faster indexing.
- Insert your Google Analytics tag in the
config.toml
file and be ready to track your site performances easily.
- The contact page can be easily customized by adding a google maps link to get directions towards your activity location.
- The theme provides some archetypes and a simple directory structure, you can publish articles/posts in more languages, set a publish date, a featured image, an expiration date and tag your posts. You can create and translate custom tags. Latest posts will appear in the homepage, every tag will have its own list page, and every post will show a list of latest related posts based on tagging. If you include titles in your posts, they will be automatically rendered in a table of contents. SEO is carefully taken care of for posts as well. You can also disable the blog part of the theme entirely if you don't need it!
-
Install hugo extended, follow the official installation guide. For using this theme you DO NOT NEED to execute
hugo new site
, as you will be cloning an example site in step 2. -
Clone the exampleSite and the theme from the repo:
git init && git clone -b exampleSite --recurse-submodules https://github.com/ololiuhqui/magnolia-free-hugo-theme <YourSiteName>
(change <YourSiteName> in the command with the name you wanna give to your site). -
Delete your default
config.toml
from the root folder of your site; the new configurations will be found inconfig/_default
. The main configuration file isconfig/_default/config.toml
, but most variables are overwritten or defined by the individual language configuration files (eg.config/_default/languages/.en.toml
) -
Move to your site directory and see the website preview with
hugo serve -D
- From the root directory of your website run:
git submodule update --remote --merge
.
-
Use your preferred color palette by modifying the Bootstrap variables in
assets/scss/custom-variables.scss
. -
Change the config files in
/config/_default
and/config/_default/languages
adding your own elements to the pages. You can change the page names there as well. -
Edit the homepage content in
content/<language>/pages/_index.html
, markdown supported. -
Edit pages names, slugs and metadescriptions in
content/<language>/pages/<page>/index.html
. -
Change the images of the website from the
content/<language>/pages/<page>/<image>
folders (pages and posts use Page bundles). -
Add your own favicon, background and default meta-image (the image used in SEO) in
assets/img
. These files can be of any extension but must have the same name of the ones currently in the example site assets directory.
Wait, you told me this theme was noob friendly, I don't wanna deal with all the blog stuff!
I need a simple landing page and all this blog feature is something I don't care about!
If you don't need posts you can disable the blog part of the theme entirely from within the config files and just use Magnolia as a simple landing site.
- To disable tags only rendering and indexing for the entire site ->
config.toml
uncomment#disableKinds = ['taxonomy', 'term']
. - To disable post and tags rendering and indexing for the entire site ->
config.toml
uncomment#disableKinds = ['taxonomy', 'term']
and#ignoreFiles= ['posts/*']
.
The /content
folder contains different types of content, the content organization mimicts the site structure.
content
βββ en
β βββ _index.md
β βββ pages
β βββ posts
β βββ profile.webp
β βββ tags
βββ it
βββ _index.md
βββ pages
βββ posts
βββ profile.webp
βββ tags
For each language, you will find yourself in front of the homepage _index.md
and the image used for the homepage presentation section (profile.webp
). The other directories will contain exactly what you expect.
pages
= normal website pages (office, services etc).
posts
= site posts.
tags
= custom tags.
- Create a new post with:
hugo new --kind post-bundle content/<lang>/posts/<post-name>
. This will be its very simple structure:
content/en/posts
βββ a-poem-about-flowers
β βββ images
β β βββ featured.jpg
β βββ index.md
-
Edit the metadata in
index.md
and add your post content below. -
Add a post featured image by subsituting the
featured.webp
placeholder in/images
. The featured image has to be called "featured" but can be of any extension. If you wish you can remove the placeholder to have a text-only post.
-
One option is to automatically create tags by adding them to posts frontmatters.
-
The second option is to create a new tag with:
hugo new --kind tag content/<lang>/tags/<tag-name>
. Creating tags this way will allow for a finer manipulation, you can translate tags here by giving the same translationKey in frontmatter in every different language. Hence having your posts sorted the same for each language and have tag pages translations available.
content/en/tags
βββ flowers
β βββ _index.md
For more on content organization refefer to Content organization | Hugo.
- Head to
config/_default/languages
. - Duplicate one of the language files, change the language tag, name of the file (en, it, fr etc): this should be compliant with RFC 5646. Use the RFC 5646 Language Tags List for a quicker setup.
- Translate the variables values inside the
.toml
file accordingly to the language. - In the
/content
directory, duplicate one of the language folders and change the name accordingly to your new language as in step 2. - For each of the
.html
file in/content/pages
, you can changetitle
andslug
freely.translationKey
should remain untouched or should be changed in every language page file. I strongly suggest you to translate the SEO here as well. - For each of the
.md
files incontent/posts/<my-post>
translate the content and the frontmatter values you need (eg. summary).
To add the custom 404 page and make it work on github pages, you will have to add it manually when building the site executing hugo
. This is because github pages looks for a 404 template in the root directory of the project, you can therefore only have one single 404 page for all the languages. To create a symlink to the english 404 version, which will then be used as default 404 once hosting, after running hugo
run ln -s public/en/404/index.html public/404.html
.
Designing this theme and making it available for you took a lot of time and effort.
The MIT license means that you are completely free to do whatevere you want with this theme, even make money from it! With the only obligation to include the attribution!
If you wish you can support me in several ways:
GitHub Sponsors
Github RepoFirst of all, PRs are welcome here!
This repo includes two main branches: main and exampleSite.
The exampleSite directory will not be shown in main branch.
If you clone the main branch you will therefore be able to modify the theme and its content only, if you clone the exampleSite branch you will be able to modify the exampleSite content only.
As an alternative you can also clone the exampleSite with the recurse-submodules
option, that will also add the theme main as submodule, making it available for changes.
main π² | exampleSite π² |
---|---|
main branch | exampleSite branch |
theme as submodule (main) |
This would be wonderful for setting up automations that use RSS feed as source like Zapier or FTTT.
Only some bootstrap variables are reassigned, leaving a lot of them to defaults. Properly assigning all the most important variables would make building, modifying and styling the theme much easier with less manual SCSS/CSS needed.
I included the scss/custom-variable.scss
file to overwrite the default variables, this would need to be updated as well with the variables that get styled in the theme, in order to give the theme user the ability to easily customize the site appeareance.
Refer to:
The website still lacks a focus on accessibility, this needs to be addressed.