Plugin -- hexo-tag-figure

Summary of this post

This post is my notes for the following topics:

  1. hexo plugin: hexo-tag-figure
  2. adding additional CSS style settings to NexT theme (by configuring custom_file_path in the file _config.next.yml)

此篇主要是記錄hexo-tag-figure的使用心得,以及如何使用_config.next.yml中的custom_file_path參數設定來增加自定義 CSS 設定內容的相關筆記。

Environment

hexo-tag-figure: 0.4.1
NexT: 8.2.1
hexo: 5.3.0
hexo-cli: 4.2.0
os: Windows_NT 10.0.18363 win32 x64

hexo-tag-figure

GitHub

hexo-tag-figure

Example

Book cover of Confessions of a Young Novelist

Code

Book cover of Confessions of a Young Novelist

CSS

  1. According to NexT’s document, extra CSS settings can be added by enable the custom_file_path in theme config file (in my case the _config.next.yml in root folder). This is my configuration:
# Define custom file paths.
# Create your custom files in site directory `source/_data` and uncomment needed files below.
custom_file_path:
  #head: source/_data/head.njk
  #header: source/_data/header.njk
  #sidebar: source/_data/sidebar.njk
  #postMeta: source/_data/post-meta.njk
  #postBodyEnd: source/_data/post-body-end.njk
  #footer: source/_data/footer.njk
  #bodyEnd: source/_data/body-end.njk
  #variable: source/_data/variables.styl
  #mixin: source/_data/mixins.styl
  style: source/_data/styles.styl # Enable this option by removing the '#' in the beginning of the line
  1. Add the styles.styl file in the path C:\Projects\hexo_blog\source\_data
  2. Add CSS settings for figcaption element, remove each image’s bottom margin by setting the margin-button to 0px. With margin-button set as 0px, the text underneath (the figcaption) will be closer to the image.
figcaption {
    color: #999;
    text-align: center;
    font-size: 14px; # Set to 14px to make the font size same as the text in table of content
}

.post-body img {
    margin-bottom: 0px;
}

margin-bottom 20px margin-bottom 0px

  1. Save the configuration and run hexo generate and hexo deploy, done ☕