为什么hexo本地预览和发布的效果不一样?

发布于 2022-09-04 04:46:29 字数 3804 浏览 12 评论 0

环境:
WINDOWS 10
HEXO
github pages
主题:yilia

问题:
写了一篇文章,在本地localhost上预览的效果是这样的

clipboard.png

鼠标放在小房子上会弹出这个菜单
但是在我的github.io上看的话就没有这个效果

clipboard.png

另外文章的标签在本地显示正确

clipboard.png

但是在github.io上就是空的

clipboard.png

请问这个问题有人遇到过吗?

总配置文件:

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: StoneHan's blog
#subtitle: 韩苏东的个人博客
#description: 韩苏东
author: StoneHan
language: zh-CN
#language: zh-Hans
avatar: /img/3.jpg
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# 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

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

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

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy: 
  type: git
  repo: git@github.com:Stone-Han/Stone-Han.github.io.git
  branch: master

主题配置文件:

# Header
menu:
  home: /
  archives: /archives
  tags: /tags
  #主页: /
  #所有文章: /archives
  #随笔: /tags/随笔

# SubNav
subnav:
  github: "https://github.com/Stone-Han"
  weibo: "http://weibo.com/2133952903/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1"
  rss: "#"
  #zhihu: "#"
  #douban: "#"
  #mail: "#"
  #facebook: "#"
  #google: "#"
  #twitter: "#"
  #linkedin: "#"

rss: /atom.xml

# 是否需要修改 root 路径
# 如果您的网站存放在子目录中,例如 http://yoursite.com/blog,
# 请将您的 url 设为 http://yoursite.com/blog 并把 root 设为 /blog/。
root: 

# Content
excerpt_link: more
fancybox: true
mathjax: true

# 是否开启动画效果
animate: true

# 是否在新窗口打开链接
open_in_new: false

# Miscellaneous
google_analytics: ''
favicon: /favicon.png

#你的头像url
avatar: http://ww2.sinaimg.cn/large/7f318987jw1f72m7gv450j205k05kmx1.jpg
#是否开启分享
share_jia: true
share_addthis: false
#是否开启多说评论,填写你在多说申请的项目名称 duoshuo: duoshuo-key
#若使用disqus,请在博客config文件中填写disqus_shortname,并关闭多说评论
duoshuo: true
#是否开启云标签
tagcloud: true

#是否开启友情链接
#不开启——
#friends: false
#开启——
friends:
  奥巴马的博客: http://localhost:4000/
  卡卡的美丽传说: http://localhost:4000/
  本泽马的博客: http://localhost:4000/
  吉格斯的博客: http://localhost:4000/
  习大大大不同: http://localhost:4000/
  托蒂的博客: http://localhost:4000/

#是否开启“关于我”。
#不开启——
#aboutme: false
#开启——
aboutme: 我是谁,我从哪里来,我到哪里去?我就是我,是颜色不一样的吃货…

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

々眼睛长脚气 2022-09-11 04:46:29

上传时候有没有 hexo clean再 hexo d -g 有时不清除下会缓存了

妥活 2022-09-11 04:46:29

chrome按F12看看是不是js、css没加载到

日记撕了你也走了 2022-09-11 04:46:29

config 修改站点地址,默认是localhost。
所以加载css js的时候,在本地当然ok。
push上去还根据config里面设置的默认地址去加载localhost/*.css之类的就找不到了。

策马西风 2022-09-11 04:46:29

先:hexo clean 清除缓存

然后: hexo g 生成待发布的文件

最后: hexo d 发布

拿命拼未来 2022-09-11 04:46:29

这个问题我也遇到了,打开F12查看,原因是一个jquery文件没有加载成功。
打开xx.github.io时,用的是https方式,从而这个jquery加载是失败的,本地是http模式。
只要在yilia里,找到jquery的加载地址,把url从http改为https就可以了。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文