1. 程式人生 > >Hexo瞎折騰系列(4) - 站點首頁不顯示文章全文

Hexo瞎折騰系列(4) - 站點首頁不顯示文章全文

文件中 alc pda date 文件 你會 功能 數據 配置

文章摘要設置

打開主題配置文件 _config.yml 文件,找到如下:

# Automatically Excerpt. Not recommend.
# Please use <!-- more --> in the post to control excerpt accurately.
auto_excerpt:
  enable: false
  length: 150

把這裏的false改為true就可以了在首頁啟動顯示文章預覽了,length是顯示預覽的長度。

這裏我們可以通過在文章使用<!-- more -->標誌來精確控制文章的摘要預覽,比如這篇文章就是在這個段落的末尾添加了該標誌,所以本文在首頁的預覽就會顯示到這個段落為止。

強烈推薦使用該<!-- more -->標誌來控制文章的摘要預覽,因為這種方式可以讓摘要也按照css文件中的樣式來渲染。如果使用了自動摘要的功能,你會發現文章摘要是一大團沒有樣式的文本,很是難看。

其他的文章配置

# ---------------------------------------------------------------
# Post Settings
# ---------------------------------------------------------------

# Automatically scroll page to section which is under <!-- more --> mark.
# 自動將頁面滾動到<!-- more -->標記下的地方。
scroll_to_more: false

# Automatically saving scroll position on each post/page in cookies.
# 自動保存每篇文章或頁面上一次滾動的地方。
save_scroll: false

# Automatically excerpt description in homepage as preamble text.
# 自動在首頁對文章進行摘要描述作為前言文本。
excerpt_description: true

# Automatically Excerpt. Not recommend.
# Please use <!-- more --> in the post to control excerpt accurately.
# 不推薦使用自動摘要。
# 請在文章中使用<!-- more -->標誌來精確控制摘要長度。
auto_excerpt:
  enable: true
  length: 200

# Post meta display settings
# 文章元數據展示設置
post_meta:
  # 文本顯示
  item_text: true
  # 創建時間
  created_at: true
  # 更新時間
  # 這個更新時間有點問題,因為每次重新生成文章/部署時都會刷新更新時間,不建議使用
  updated_at: false
  # 目錄分類
  categories: true

# Post wordcount display settings
# Dependencies: https://github.com/willin/hexo-wordcount
# 文章字數展示設置
post_wordcount:
  # 文本顯示
  item_text: true
  # 文章字數統計
  wordcount: true
  # 閱讀時長
  min2read: true
  # 站點總字數統計
  totalcount: true
  # 該post_wordcount的所有設置另起一行顯示
  separated_meta: true

Hexo瞎折騰系列(4) - 站點首頁不顯示文章全文