carpet
Carpet
Nikola theme based from Bulma. Nikola is a static site and blog generator. Template is using Mako syntax and Font Awesome 4 icons.
Installation
To install:
Enter the command line below at the console
$ nikola install_theme carpet
Edit conf.py for setting these values below:
THEME = "carpet"
Default extra global context values:
GLOBAL_CONTEXT = { "carpet__unlink_blog_brand": False, "carpet__show_hero": False, "carpet__show_hero_title": False, "carpet__hero_post_title": False, "carpet__hero_size": "", "carpet__hero_footer": "", "carpet__late_load_css": False, "carpet__breadcrumb_home": "", "carpet__breadcrumb_separator": "", "carpet__post_type": {}, "carpet__head_prefix": "", "carpet__body_prefix": "", "carpet__content_prefix": "", "carpet__content_suffix": "", "carpet__cookie_message": "" }
Extra Metadata
- hero-class
- show-hero
- hero-title
- hero-description
Blog brand
By default, the blog brand is a link for either blog logo or/and blog title by having values on configuration file. For example,
BLOG_TITLE = AUTHOR_NAME LOGO_URL = "/logo.png" SHOW_BLOG_TITLE = True
If you don't want them to be a link, set carpet__unlink_blog_brand to
True.
Hero
This theme supports Hero feature from Bulma. If you
like to turn on the feature, set carpet__show_hero to True.
Custom Hero background
By default the background colour of the Hero is primary colour, same colour as the top navigation. There are few classes can be used for background customisation.
- The
hero-bodyclass is appeared in all the Hero. - Each pages have
hero-${title|lower,h,trim}class too, where title is the page title with all lower case, and number with no special characters (including space characters). - All
POSTSandPAGEScan also have extra classes by adding value tohero-classmetadata.
Custom Hero title
By default, there is no text in the Hero. If the feature is turn on, by default
the text will show BLOG_TITLE and/or BLOG_DESCRIPTION depending if the
values are not empty. Here are few more customisation:
- All
POSTSandPAGEShave the same hero text, setcarpet__show_hero_titleto True. - To customise all
POSTSandPAGESwith different Hero text, setcarpet__hero_post_titleto True. Only those pages that accept metadata values. - By default, there is no Hero text.
- Turn on hero text in each
POSTSpage, setshow-herometadata to True. It will show the default values, which areBLOG_TITLEand/orBLOG_DESCRIPTIONdepending if the values are not empty. - To customise each
POSTSpage, setshow-herotocustom. It will usehero-titleand/orhero-descriptiondepending if the values are not empty.
Custom Hero size
There are few sizes come with Bulma Hero, is-medium,
is-large and is-fullheight. Change these values to
carpet__hero_size. Refer to
Bulma Hero for more info.
Custom Hero footer
If you like to have Hero footer, add value to carpet__hero_footer.
Breadcrumb
Be default, breadcrumb doesn't have any icons. If you like to have icons on either breadcrumb home and/or separators, here are the example values:
GLOBAL_CONTEXT = { "carpet__breadcrumb_home": "fa-home", "carpet__breadcrumb_separator": "fa-angle-right" }
Post type
If you are using post type features, you can have different icons for different post types. Below are examples values:
GLOBAL_CONTEXT = { "carpet__post_type": { "text": "fa-file-text-o", "quote": "fa-quote-right", "book": "fa-book", "recipe": "fa-bookmark", "link": "fa-link", "video": "fa-film", "photo": "fa-image-o" } }
Custom colour theme
Currently, there is no easy way to change the theme colour. In order to do it, you need to regenerate the CSS files. Here are the steps:
- At the root of the theme, enter this command in the console / terminal,
make install. It will install all the JavaScript packages that needed for regenerating the CSS files. - All the custom styles that depending on
Bulma variables
need to be before import statement in
src/scss/main.scssfiles. For example, in this theme, the primary color is changed to#445826. - After all customisation, enter this command in the console / terminal,
make build. It will regenerate all the CSS files and place them inassets/css/folder.
Optimise CSS delivery
Anyone who is interested in Optimise CSS delivery, this theme manage to improve it using Critical tool. Here are the steps:
- At the root of the theme, enter this command in the console / terminal,
make install. It will install all the JavaScript packages that needed for generating critical-path CSS. - Firstly,
- set
carpet__late_load_cssto False - For best result, set
USE_BUNDLESto True, which is easier to convert one CSS file - enter
nikola buildto build all theoutputfiles - As the tool only support one source file,
- find the any pages of the site that use the most CSS style and update the
srcfile value ingulpfile.js - also make sure the
basefolder is correct, which isoutputfolder - Once the values in
gulpfile.jsare correct based on your need, enter this command in the console / terminal,gulp critical. - Once the
destfile is generated, - copy the inline CSS code to
EXTRA_HEAD_DATA - set
carpet__late_load_cssto True - enter
nikola buildto rebuild all theoutputfiles again
Cookie message
It is to display information about cookies to the users.
-
carpet__cookie_message- cookie message notification -
carpet__cookie_path- (optional) for changing cookie path, by default it is across the entire domain -
carpet__cookie_expiry- (optional) for extending cookie lifetime, by default it is 30 days
More contents
-
carpet__head_prefix- extra custom content right after opening<head> -
carpet__body_prefix- extra custom content right after opening<body> -
carpet__content_prefix- extra custom content right before<main>content -
carpet__content_suffix- extra custom content right after<main>content
Known Issues
- Not all features of Nikola are tested
- Value of
THEME_COLORis not used
Todo list
- Optimise images with image compression
Dependencies
License
Carpet - MIT License
Nikola - MIT License
Mako - MIT License
Bulma MIT License
Font Awesome Full details
Cookie message MIT License
Suggested Configuration:
GLOBAL_CONTEXT = { "carpet__unlink_blog_brand": False, "carpet__show_hero": True, "carpet__show_hero_title": True, "carpet__hero_post_title": False, "carpet__hero_size": "", "carpet__hero_footer": "", "carpet__late_load_css": False, "carpet__breadcrumb_home": "fa-home", "carpet__breadcrumb_separator": "fa-angle-right", "carpet__post_type": { "text": "fa-file-text-o" }, "carpet__head_prefix": "", "carpet__body_prefix": "", "carpet__content_prefix": "", "carpet__content_suffix": "", "carpet__cookie_message": "" }
Issues? Questions?
You can report issues with this theme and request help via GitHub Issues (themes repository).
