next主题配置文件配置项介绍

5 篇文章 0 订阅

上篇博客我们介绍了站点配置文件中的大部分配置项的作用,本篇博客则是介绍next主题的主题配置文件中配置项的作用。

# Allow to cache content generation.
cache:                       # 是否允许缓存内容生成,默认即可
  enable: true

# Remove unnecessary files after hexo generate.
minify: false               # 是否允许生成最小化hexo网站,默认即可

# 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


# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------

# Schemes    # 视图选择,这个看个人喜好,我个人是偏向Gemini
scheme: Muse             # Muse默认方案,使用黑白色调
#scheme: Mist			 # Mist具有整洁的单列视图
#scheme: Pisces          # Pisces 双栏方案
#scheme: Gemini			 # Gemini看起来像双鱼座,但有明显的带有阴影的柱状块,看起来对视图更敏感

# Dark Mode
darkmode: false         # 是否开启黑暗模式


# ---------------------------------------------------------------
# Site Information Settings
# ---------------------------------------------------------------

# 网站图标设置,可以自定义图标,然后把图片资源放在source/images目录中即可,为了增快访问速度,可以把资源放在其他地方
favicon:
  small: /images/favicon-16x16-next.png
  medium: /images/favicon-32x32-next.png
  apple_touch_icon: /images/apple-touch-icon-next.png
  safari_pinned_tab: /images/logo.svg
  #android_manifest: /manifest.json

# 自定义徽标,看个人选择
# Custom Logo (Warning: Do not support scheme Mist)
custom_logo: #/uploads/custom-logo.jpg

# 创建共用,实际上就是展示版权信息,看个人选择
# Creative Commons 4.0 International License.
# See: https://creativecommons.org/about/cclicenses/
creative_commons:
  # Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | cc-zero
  license: by-nc-sa
  # Available values: big | small
  size: small
  sidebar: false
  post: false
  # You can set a language value if you prefer a translated version of CC license, e.g. deed.zh
  # CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org
  language:

# Open graph settings
# See: https://hexo.io/docs/helpers#open-graph

# 没仔细去研究,反正默认即可
open_graph:
  enable: true
  options:
    #twitter_card: <twitter:card>
    #twitter_id: <twitter:creator>
    #twitter_site: <twitter:site>
    #twitter_image: <twitter:image>
    #google_plus: <g+:profile_link>
    #fb_admins: <fb:admin_id>
    #fb_app_id: <fb:app_id>


# ---------------------------------------------------------------
# Menu Settings
# ---------------------------------------------------------------

# Usage: `Key: /link/ || icon`
# Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-sensitive.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# External url should start with http:// or https://
# 菜单配置项,一般用到首页、标签、分类等菜单,启用某菜单项的话需要配置相关的页面,配置相关页面在source目录下创建
menu:
  #home: / || fa fa-home
  #about: /about/ || fa fa-user
  #tags: /tags/ || fa fa-tags
  #categories: /categories/ || fa fa-th
  #archives: /archives/ || fa fa-archive
  #schedule: /schedule/ || fa fa-calendar
  #sitemap: /sitemap.xml || fa fa-sitemap
  #commonweal: /404/ || fa fa-heartbeat

# Enable / Disable menu icons / item badges.
# 是否启用菜单图标以及菜单项统计,建议都开
menu_settings:
  icons: true
  badges: false


# ---------------------------------------------------------------
# Sidebar Settings
# See: https://theme-next.js.org/docs/theme-settings/sidebar
# ---------------------------------------------------------------
# 侧边栏设置,设置侧边栏位置,看个人喜欢
sidebar:
  # Sidebar Position.
  position: left
  #position: right
  
# 侧边栏宽度设置,没有特殊要求默认即可
  # Manual define the sidebar width. If commented, will be default for:
  # Muse | Mist: 320
  # Pisces | Gemini: 240
  #width: 300

# 设置侧栏显示的时机,仅适用于Muse | Mist,由于我设置的是Gemini,所以这块没怎么研究,感兴趣的话可以自行研究
  # Sidebar Display (only for Muse | Mist), available values:
  #  - post    expand on posts automatically. Default.
  #  - always  expand for all pages automatically.
  #  - hide    expand only when click on the sidebar toggle icon.
  #  - remove  totally remove sidebar including sidebar toggle.
  display: post

# 设置侧边栏填充
  # Sidebar padding in pixels.
  padding: 18
# 侧边栏与顶部菜单栏的位置
  # Sidebar offset from top menubar in pixels (only for Pisces | Gemini).
  offset: 12

# Sidebar Avatar
# 是否设置侧边栏图像,看个人爱好
avatar:
  # Replace the default image and set the url here.
  url: #/images/avatar.gif
  # If true, the avatar will be displayed in circle.
  # 是否显示为圆形图像
  rounded: false
  # If true, the avatar will be rotated with the cursor.
  # 是否设置鼠标悬停时旋转头像
  rotated: false

# 是否在侧边栏显示分类、标签等
# Posts / Categories / Tags in sidebar.
site_state: true

# 社交链接添加
# Social Links
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimiter is the target permalink, value after `||` delimiter is the name of Font Awesome icon.
social:
  #GitHub: https://github.com/yourname || fab fa-github
  #E-Mail: mailto:yourname@gmail.com || fa fa-envelope
  #Weibo: https://weibo.com/yourname || fab fa-weibo
  #Google: https://plus.google.com/yourname || fab fa-google
  #Twitter: https://twitter.com/yourname || fab fa-twitter
  #FB Page: https://www.facebook.com/yourname || fab fa-facebook
  #StackOverflow: https://stackoverflow.com/yourname || fab fa-stack-overflow
  #YouTube: https://youtube.com/yourname || fab fa-youtube
  #Instagram: https://instagram.com/yourname || fab fa-instagram
  #Skype: skype:yourname?call|chat || fab fa-skype

social_icons:
  enable: true
  icons_only: false
  transition: false

# 友情链接添加
# Blog rolls
links_settings:
  icon: fa fa-globe   # 图标可以选择其他图标,我个人使用的是fa fa-link
  title: Links
  # Available values: block | inline
  layout: block   # 友链布局
# 友链链接
links:
  #Title: https://example.com


# 侧边栏目录
# Table of Contents in the Sidebar
# Front-matter variable (nonsupport wrap expand_all).
toc:
  enable: true
  # Automatically add list number to toc.
  # 是否自动添加编号,建议写Markdown的时候就添加编号,然后这里关掉
  number: true
  # If true, all words will placed on next lines if header width longer then sidebar width.
  # 当标题宽度大于侧边栏宽度时,是否将标题放在下一行
  wrap: false
  # If true, all level of TOC in a post will be displayed, rather than the activated part of it.
  # 是否显示所有级别的目录
  expand_all: false
  # Maximum heading depth of generated toc.
  # 目录深度
  max_depth: 6


# 页脚设置
# ---------------------------------------------------------------
# Footer Settings
# See: https://theme-next.js.org/docs/theme-settings/footer
# ---------------------------------------------------------------

# 是否在页脚中显示多语言切换器
# Show multilingual switcher in footer.
language_switcher: false

footer:
  # Specify the year when the site was setup. If not defined, current year will be used.
  # 设置站点的年份,若未设置,则使用当前年份
  #since: 2021

  # Icon between year and copyright info.
  icon:
    # Icon name in Font Awesome. See: https://fontawesome.com/icons
    # 页脚小图标
    name: fa fa-heart  
    # If you want to animate the icon, set it to true.
    # 是否设置图标动画
    animated: false
    # Change the color of icon, using Hex Code.
    # 图标颜色
    color: "#ff0000"

  # If not defined, `author` from Hexo `_config.yml` will be used.
  copyright:

# 是否显示页脚的强力驱动
  # Powered by Hexo & NexT
  powered: true

# 是否显示ICP等信息
  # Beian ICP and gongan information for Chinese users. See: https://beian.miit.gov.cn, http://www.beian.gov.cn
  beian:
    enable: false
    icp:
    # The digit in the num of gongan beian.
    gongan_id:
    # The full num of gongan beian.
    gongan_num:
    # The icon for gongan beian. See: http://www.beian.gov.cn/portal/download
    gongan_icon_url:


# ---------------------------------------------------------------
# Post Settings
# See: https://theme-next.js.org/docs/theme-settings/posts
# ---------------------------------------------------------------

# 是否自动将主页中的描述摘录为前言文本,建议开启
# Automatically excerpt description in homepage as preamble text.
excerpt_description: true

# Read more button
# If true, the read more button will be displayed in excerpt section.
# 是否显示阅读更多按钮,建议开启
read_more_btn: true

# Post meta display settings
post_meta:
  item_text: true        # 显示帖子的描述文本。
  created_at: true       # 显示帖子的创建时间
  updated_at:
    enable: true          # 显示帖子的更新时间
    another_day: true     
  categories: true       # 是否显示帖子类别

# 帖子字数以及阅读时间显示,需要安装hexo-word-counter 插件,并在站点配置文件中启用
# Post wordcount display settings
# Dependencies: https://github.com/next-theme/hexo-word-counter
symbols_count_time:
  separated_meta: true     # 是否在单独的行显示字数和阅读时间
  item_text_total: false   # 是否在页脚显示字数和预计阅读时间

# 更改文章底部tag图标
# Use icon instead of the symbol # to indicate the tag at the bottom of the post
tag_icon: false

# 捐献设置,我的博客是技术分享,不设置捐献,所以我也没多研究
# Donate (Sponsor) settings
# Front-matter variable (nonsupport animation).
reward_settings:
  # If true, a donate button will be displayed in every article by default.
  enable: false
  animation: false
  #comment: Buy me a coffee

reward:
  #wechatpay: /images/wechatpay.png
  #alipay: /images/alipay.png
  #paypal: /images/paypal.png
  #bitcoin: /images/bitcoin.png

# Subscribe through Telegram Channel, Twitter, etc.
# Usage: `Key: permalink || icon` (Font Awesome)
follow_me:
  #Twitter: https://twitter.com/username || fab fa-twitter
  #Telegram: https://t.me/channel_name || fab fa-telegram
  #WeChat: /images/wechat_channel.jpg || fab fa-weixin
  #RSS: /atom.xml || fa fa-rss

# 相关热门帖子,需要安装hexo-related-posts插件,然后在post页面中增加代码
# Related popular posts
# Dependencies: https://github.com/sergeyzwezdin/hexo-related-posts
related_posts:
  enable: false
  title: # Custom header, leave empty to use the default one  # 默认使用相关帖子作为标题
  display_in_home: false  # 是否在首页显示相关帖子
 
# 帖子编辑功能,建议关闭,该功能可以让用户在 GitHub 上快速浏览和修改博客的源代码。
# Post edit
# Easily browse and edit blog source code online.
post_edit:
  enable: false
  url: https://github.com/user-name/repo-name/tree/branch-name/subdirectory-name/ # Link for view source
  #url: https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name/ # Link for fork & edit

# 发布导航功能,在帖子页脚中显示上一篇或者下一篇
# Show previous post and next post in post footer if exists
# Available values: left | right | false
post_navigation: left

# 设置自定义页面
# ---------------------------------------------------------------
# Custom Page Settings
# See: https://theme-next.js.org/docs/theme-settings/custom-pages
# ---------------------------------------------------------------

# 标签设置页面
# TagCloud settings for tags page.
tagcloud:
  min: 12 # Minimum font size in px
  max: 30 # Maximum font size in px
  amount: 200 # Total amount of tags
  orderby: name # Order of tags
  order: 1 # Sort order

# 谷歌日历页面
# Google Calendar
# Share your recent schedule to others via calendar page.
calendar:
  calendar_id: <required> # Your Google account E-Mail
  api_key: <required>
  orderBy: startTime
  showLocation: false
  offsetMax: 72 # Time Range
  offsetMin: 4 # Time Range
  showDeleted: false
  singleEvents: true
  maxResults: 250


# ---------------------------------------------------------------
# Misc Theme Settings
# See: https://theme-next.js.org/docs/theme-settings/miscellaneous
# ---------------------------------------------------------------

# NexT 支持添加预连接资源提示以建立与字体和插件来源的早期连接。
# Preconnect CDN for fonts and plugins.
# For more information: https://www.w3.org/TR/resource-hints/#preconnect
preconnect: false

# 文本对齐
# Set the text alignment in posts / pages.
text_align:
  # Available values: start | end | left | right | center | justify | justify-all | match-parent
  desktop: justify
  mobile: justify

# 移动设备适配
# Reduce padding / margin indents on devices with narrow width.
mobile_layout_economy: false

# 主题颜色
# Browser header panel color.
theme_color:
  light: "#222"
  dark: "#222"

# 正文滚动条,覆盖浏览器的默认行为
# Override browsers' default behavior.
body_scrollbar:
  # Place the scrollbar over the content.
  # 将滚动条放在内容上
  overlay: false
  # Present the scrollbar even if the content is not overflowing.
  # 显示滚动条,即使内容没有溢出
  stable: false

# 代码块相关功能
codeblock:
  # Code Highlight theme
  # All available themes: https://theme-next.js.org/highlight/
  theme:
    light: default
    dark: stackoverflow-dark
  prism:
    light: prism
    dark: prism-dark
  # Add copy button on codeblock
  # 添加复制按钮
  copy_button:
    enable: false
    # Available values: default | flat | mac
    style:

# 返回顶部
back2top:
  enable: true
  # Back to top in sidebar.
  # 在侧边栏中返回顶部
  sidebar: false
  # Scroll percent label in b2t button.
  # 显示滚动百分比
  scrollpercent: false

# 显示阅读进度
# Reading progress bar
reading_progress:
  enable: false
  # Available values: left | right
  start_at: left
  # Available values: top | bottom
  position: top
  reversed: false
  color: "#37c6c0"
  height: 3px

# 保存阅读进度(书签)
# Bookmark Support
bookmark:
  enable: false
  # Customize the color of the bookmark.
  color: "#222"
  # If auto, save the reading progress when closing the page or clicking the bookmark-icon.
  # If manual, only save it by clicking the bookmark-icon.
  save: auto
  
# GitHub 横幅
# `Follow me on GitHub` banner in the top-right corner.
github_banner:
  enable: false
  permalink: https://github.com/yourname
  title: Follow me on GitHub


# ---------------------------------------------------------------
# Font Settings
# ---------------------------------------------------------------
# Find fonts on Google Fonts (https://fonts.google.com)
# All fonts set here will have the following styles:
#   light | light italic | normal | normal italic | bold | bold italic
# Be aware that setting too much fonts will cause site running slowly
# ---------------------------------------------------------------
# Web Safe fonts are recommended for `global` (and `title`):
# Arial | Tahoma | Helvetica | Times New Roman | Courier New | Verdana | Georgia | Palatino | Garamond | Comic Sans MS | Trebuchet MS
# ---------------------------------------------------------------

# 自定义字体,分为全局字体、网站标题字体、文章标题字体、文章字体和代码字体,说实话,没啥必要去自定义字体
font:
  enable: false

  # Uri of fonts host, e.g. https://fonts.googleapis.com (Default).
  host:

  # Font options:
  # `external: true` will load this font family from `host` above.
  # `family: Times New Roman`. Without any quotes.
  # `size: x.x`. Use `em` as unit. Default: 1 (16px)

  # Global font settings used for all elements inside <body>.
  global:
    external: true
    family: Lato
    size:

  # Font settings for site title (.site-title).
  title:
    external: true
    family:
    size:

  # Font settings for headlines (<h1> to <h6>).
  headings:
    external: true
    family:
    size:

  # Font settings for posts (.post-body).
  posts:
    external: true
    family:

  # Font settings for <code> and code blocks.
  codes:
    external: true
    family:


# 搜索引擎优化
# ---------------------------------------------------------------
# SEO Settings
# See: https://theme-next.js.org/docs/theme-settings/seo
# ---------------------------------------------------------------

# If true, site-subtitle will be added to index page.
# Remember to set up your site-subtitle in Hexo `_config.yml` (e.g. subtitle: Subtitle)
index_with_subtitle: false

# Automatically add external URL with Base64 encrypt & decrypt.
exturl: false
# If true, an icon will be attached to each external URL
exturl_icon: true


# 设置谷歌站长工具的验证字符串用于提交站点地图。
# Google Webmaster tools verification.
# See: https://developers.google.com/search
google_site_verification:

# 设置必应站长工具的验证字符串用于提交站点地图。
# Bing Webmaster tools verification.
# See: https://www.bing.com/webmasters
bing_site_verification:

# Yandex Webmaster tools verification.
# See: https://webmaster.yandex.ru
yandex_site_verification:

# Baidu Webmaster tools verification.
# See: https://ziyuan.baidu.com/site
baidu_site_verification:

# 第三方插件和服务设置,在这里不讲,后面优化博客的时候如果用到会说,第三方插件并不是所有都会用到
# ---------------------------------------------------------------
# Third Party Plugins & Services Settings
# See: https://theme-next.js.org/docs/third-party-services/
# More plugins: https://github.com/next-theme/awesome-next
# You may need to install the corresponding dependency packages
# ---------------------------------------------------------------

next主题配置文件的配置项很多,但是其实大部分我们是不需要改动的。而且为了以后升级主题,不建议直接在主题配置文件中改动配置,而是使用备用主题配置来配置主题,至于怎么使用会在后续的博客中说。
我的博客:https://blog.z7sz.top

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
您好!对于从 properties 文件中读取配置,您可以使用 Java 的 Properties 类来实现。以下是一个简单的示例代码: ```java import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; public class ConfigReader { private Properties properties; public ConfigReader(String filePath) { properties = new Properties(); try { FileInputStream fileInputStream = new FileInputStream(filePath); properties.load(fileInputStream); fileInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } public String getProperty(String key) { return properties.getProperty(key); } public static void main(String[] args) { ConfigReader configReader = new ConfigReader("config.properties"); String username = configReader.getProperty("db.username"); String password = configReader.getProperty("db.password"); System.out.println("Username: " + username); System.out.println("Password: " + password); } } ``` 上述代码创建了一个 ConfigReader 类,通过构造函数传入 properties 文件的路径,并提供了一个 getProperty 方法用于获取指定键的配置值。在 main 方法中,我们创建了一个 ConfigReader 对象,并从配置文件中获取了数据库的用户名和密码。 至于从数据库中读取配置,可以使用 JDBC 连接数据库,并执行 SQL 查询来获取相应的配置值。以下是一个简单的示例代码: ```java import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class DBConfigReader { private Connection connection; public DBConfigReader(String url, String username, String password) { try { connection = DriverManager.getConnection(url, username, password); } catch (SQLException e) { e.printStackTrace(); } } public String getProperty(String key) { String value = null; try { Statement statement = connection.createStatement(); String query = "SELECT value FROM config WHERE key = '" + key + "'"; ResultSet resultSet = statement.executeQuery(query); if (resultSet.next()) { value = resultSet.getString("value"); } statement.close(); } catch (SQLException e) { e.printStackTrace(); } return value; } public static void main(String[] args) { String url = "jdbc:mysql://localhost:3306/mydb"; String username = "root"; String password = "password"; DBConfigReader dbConfigReader = new DBConfigReader(url, username, password); String apiKey = dbConfigReader.getProperty("api.key"); System.out.println("API Key: " + apiKey); } } ``` 上述代码创建了一个 DBConfigReader 类,通过构造函数传入数据库的 URL、用户名和密码,提供了一个 getProperty 方法用于执行 SQL 查询并获取指定键的配置值。在 main 方法中,我们创建了一个 DBConfigReader 对象,并从数据库中获取了 API 密钥。 请注意,以上只是示例代码,您需要根据实际情况进行适当的修改和调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xingyuzhongxuan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值