next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.46k stars 437 forks source link

网页字体修改为思源宋体-无法显示,任何和字体有关的代码都修改了,还是没有用,求大佬帮助 #622

Closed suliblog closed 1 year ago

suliblog commented 1 year ago

Issue Checklist

Expected behavior

执行hexo s,打开网页 http://localhost:4000/,本地字体显示正常,见下图

image

Actual behavior

Steps to reproduce the behavior

  1. 先修改了 _config.next.yml,只要是能写字体的地方都改成了思源宋体 image
  2. 再去 blog/themes/next/source/css/_variables/base.styl 下修改字体 image
  3. 多次 hexo clean,hexo g -d;hexo s 本地显示时,字体可以正常显示。但一旦到https://suliblog.github.io/上,字体依旧没有显示;我用f12 检查了字体文件,显示来自一个莫名其妙的网址,求帮助,实在是找不到原因了 image

Node.js and NPM Information

node -v:
v16.13.0
npm -v:
9.6.1

Package dependencies Information

|── @next-theme/plugins@8.15.0
├── hexo-abbrlink@2.2.1
├── hexo-all-minifier@0.5.7
├── hexo-deployer-git@4.0.0
├── hexo-generator-archive@2.0.0
├── hexo-generator-category@2.0.0
├── hexo-generator-index@3.0.0
├── hexo-generator-tag@2.0.0
├── hexo-neat@1.0.9
├── hexo-renderer-ejs@2.0.0
├── hexo-renderer-markdown-it@7.0.0
├── hexo-renderer-stylus@2.1.0
├── hexo-server@3.0.0
├── hexo-theme-landscape@0.0.3
├── hexo-word-counter@0.1.0
├── hexo@6.3.0
├── markdown-it-emoji@2.0.2
├── markdown-it-footnote@3.0.3
├── markdown-it-ins@3.0.1
├── markdown-it-merge-cells@2.0.0
├── markdown-it-sub@1.0.0
└── markdown-it-sup@1.0.0

Hexo Configuration

# Site
title: 酥梨
subtitle: 若等不到冰雪消融,就放一把大火烧了,烧成另一个春天
description: 自由是生命/书籍是世界/自然是天地
keywords:
author: suli
language: zh-CN
timezone: Asia/Shanghai

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
## pid 代表文章发表顺序
url: https://suliblog.github.io/
root: /
permalink: /posts/:abbrlink/ 
permalink_defaults:
pretty_urls:
  trailing_index: false # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: false # Set to false to remove trailing '.html' from permalinks

# abbrlink config
abbrlink:
  alg: crc32      #support crc16(default) and crc32
  rep: hex        #support dec(default) and hex
  drafts: false   #(true)Process draft,(false)Do not process draft. false(default) 
  # Generate categories from directory-tree
  # depth: the max_depth of directory-tree you want to generate, should > 0
  auto_category:
     enable: true  #true(default)
     depth:        #3(default)
     over_write: false 
  auto_title: false #enable auto title, it can auto fill the title by path
  auto_date: false #enable auto date, it can auto fill the date by time today
  force: false #enable force mode,in this mode, the plugin will ignore the cache, and calc the abbrlink for every post even it already had abbrlink. This only updates abbrlink rather than other front variables.

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: ''
code_dir: downloads/code
i18n_dir: :lang
# 跳过指定文件的渲染。匹配到的文件将会被不做改动地复制到 public 目录中。您可使用 glob 表达式来匹配路径。
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true

#代码块的设置, 请参考 Highlight.js 进行设置
highlight:
  enable: false

#代码块的设置, 请参考 PrismJS 进行设置
prismjs:
  enable: true
  preprocess: true
  line_number: false
  tab_replace: ''

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 5
  order_by: -date

# Category & Tag
default_category: 
category_map:
  人生录: life
  项目集: project
  思想册: models
tag_map:

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

# Minifier & Optimization plugin hexo优化方案 插件静态资源压缩
## See: https://github.com/chenzhutian/hexo-all-minifier
html_minifier:
  silent: true
css_minifier:
  silent: true
js_minifier:
  silent: true
image_minifier:
  enable: false

# hexo-renderer-markdown-it MarKdown插件
## See: https://github.com/hexojs/hexo-renderer-markdown-it/wiki/Advanced-Configuration
#脚注 npm install markdown-it-footnote --save
#下划线 npm install markdown-it-ins --save
#下角标 npm install markdown-it-sub --save
#上角标 npm install markdown-it-sup --save
#表情 npm install markdown-it-emoji --save
#合并相同单元格 npm install markdown-it-merge-cells
markdown:
  langPrefix: 'language-'
  plugins:
    - markdown-it-footnote
    - markdown-it-ins
    - markdown-it-sub
    - markdown-it-sup
    - markdown-it-emoji
    - markdown-it-merge-cells

NexT Configuration

font:
  enable: true

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

  global:
    external: true
    family: Noto Serif SC
    size:

  # Font settings for site title (.site-title).
  title:
    external: true
    family: Noto Serif SC
    size: 2.2

  headings:
    external: true
    family: Noto Serif SC
    size: 1.6

  posts:
    external: true
    family: Noto Serif SC

  # Font settings for <code> and code blocks.
  codes:
    external: true
    family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace

Other Information

No response

welcome[bot] commented 1 year ago

Thanks for opening this issue, maintainers will get back to you as soon as possible!

stevenjoezhang commented 1 year ago

Google 有时候会莫名其妙的封掉一些域名,你的 github.io 域名就遇到了这个问题,所以加载不出字体 (如下图,直接返回 403 了)

截屏2023-03-11 13 27 16

解决方案参考 https://github.com/theme-next/hexo-theme-next/issues/613

github-actions[bot] commented 7 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.