Skip to content
Borche edited this page Oct 11, 2019 · 7 revisions

Different types of configuration options

There are 3 different places where configuration options can be found:

  1. The global config, which is the _config.yml file located in the project root directory.
  2. The theme config located in /theme/gradient/_config.yml
  3. Different front matter attributes, which can be configured individually for each post.

Configuration options

Listed bellow are configuration options for the common site/theme features.

Site title

The site title can be set by changing the title property in the global config.

Menu

The menu can be configured in the theme config.

Example:

menu:
  Home: /
  🗂️Archives: /archives
  Hexo: https://hexo.io/

Footer

The footer is a list of font awesome icons and can be configured in the theme config.

Example:

footer_icons:
  'Hexo.io':
    url: 'https://hexo.io/'
    class: 'fas fa-home'
  '@hexojs':
    url: 'https://twitter.com/hexojs'
    class: 'fab fa-twitter'
  'Report issue':
    url: 'https://github.com/RandomAdversary/Gradient/issues'
    class: 'fas fa-bug'

Featured image

Featured image via front matter

The recommended way is to use featured_image attribute in front matter, and have different image for each post.

Example:

---
title: ❤️ Welcome to Gradient ❤️
date: 2018-10-14 23:47:55
featured_image: images/welcome.jpg
---
This post uses welcome.jpg as featured image.

Featured image via theme config

If featured_image attribute is missing from the front matter, then, the default featured image will be used.

The default featured image can be found at /source/img/default.jpg

and can be configured through the theme config like this:

# If featured_image is missing from a post, this one will be used.
featured_image: ./img/default.jpg

Summary

The post summary should be configured through the summary attribute in front matter. if the summary is missing, the article.excerpt variable will be used.

Example:

---
title: ❤️ Welcome to Gradient ❤️
date: 2018-10-14 23:47:55
summary: Gradient is clean and modern hexo theme.
---
Welcome to gradient!

Sidebar

The sidebar can be changed in the theme config. It has 2 parts, a twitter widget and unlimited amount of html blocks.

Example:

sidebar:
  twitter:
    enabled: true
    username: 'hexojs'
    height: 800
  tldr: 
    - block1: 
      title: 'TL;DR'
      content: 'Yet another hexo theme.'
    - block2: 
      title: 'TL;DR 2'
      content: '<a href="https://borche.dev/">Yes, you can use html.</a>'

Meta tags / SEO

Gradient supports twitter cards and open graph protocol in order to provide better experience for social media shares and search engine optimisation.

The mapping for these meta tags can be seen in the source code of the theme.