更改域名後網站非正常加載
有多種可能的原因。
- 一種是更換域名解析需要等待10分鐘。
- 網站配置文件不正確。原因是新的域名下,網站加載的文件會多了一層。
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
#url: https://jjl0229.github.io/Jjl0229/
#root: /Jjl0229/
url: https://jjl.gold/ #更改爲此 https://新的域名/
root: / #更改爲此
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
-
CNAME文件添加不正確
CNAME文件格式爲“.”,且內容只包含你的新域名,建議和github上添加的一樣不帶“www”
例如我的內容是:jjl.gold
-
網站解析錯誤
我的網站解析添加兩個內容就夠了
首先在本地cmd輸入,xxxx爲github用戶名ping xxxx.github.oi.
可獲得githubpages的地址
添加解析:
markdown使用數學公式
hexo的默認md渲染器和標準不太一樣,更接近與html格式,數學公式$之類的符號不能顯示。
- 首先更換新的渲染器:
npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save
- 在根目錄下開始(node_modules\kramed\lib\rules\inline.js)
修改以下兩處
//escape: /^\\([\\`*{}\[\]()#$+\-.!_>])/,
escape: /^\\([`*\[\]()#$+\-.!_>])/,
//em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
- 在next主題的配置文件中,如果想用katex同理
# Math Formulas Render Support
math:
# Default (true) will load mathjax / katex script on demand.
# That is it only render those page which has `mathjax: true` in Front-matter.
# If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
per_page: true
engine: mathjax # 添加這個,反正我的主題默認沒有這一行
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
enable: true # 這個改爲true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: true # 這個改爲true
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support.
katex:
enable: false
# See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
copy_tex: false
- 寫博客時加上"mathjax: true"
title: xxxx
date: xxxx-xxxx-xxxx
mathjax: true
 
### markdown上傳圖片
在本地markdown編譯器顯示正常,但是網站內加載不出圖片。
- 首先安裝
```js
npm install https://github.com/CodeFalling/hexo-asset-image -- save
- 找到站點配置文件的“post_asset_folder”
#post_asset_folder: false post_asset_folder: true
- 最後在發佈新博客時_post會自動生成一個和你博客名相同的文件夾,將圖片放在文件夾內,只需要xxx.jpg,不需要添加路徑
![](xxx.jpg)
更換網站圖標
推薦一個網站找圖標(https://www.easyicon.net/)
- 找到(next\source\images) 添加你選擇的圖片 注意最好是.ico格式
- 在主題的配置文件中搜索"favicon"
內容如下:
favicon:
small: /images/favicon16.ico
medium: /images/favicon32.ico
apple_touch_icon: /images/apple-touch-icon-next.png
safari_pinned_tab: /images/logo.svg
#android_manifest: /images/manifest.json
#ms_browserconfig: /images/browserconfig.xml
將small,medium更換爲你的圖片,small是16x16 medium爲32x32格式的。apple_touch_icon和safari_pinned_tab時ios上的識別圖標,有需要也可以改。
發佈新的欄目
例如我要發佈一個名爲相冊的欄目
首先在gitbash發佈欄目
hexo new page "photos"
在主題的配置文件裏搜索“menue”,然後新添加一行
“||”的單詞後是圖標名
menu:
home: / || home
categories: /categories/ || th
tags: /tags/ || tags
archives: /archives/ || archive
相冊: /photos/ || photo #新添加
about: /about/ || user
#schedule: /schedule/ || calendar
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat
添加social鏈接
在主題的配置文件裏搜索“social”,然後新添加一行。注意||後的圖片一定要填正確,不知道可以去找網站搜一下,否則網站會打不開。
social:
GitHub: https://github.com/yourname || github
Codeforces: http://codeforces.com/profile/hello201999 || code
CSDN: https://blog.csdn.net/weixin_43769146 || csdn
b站: https://space.bilibili.com/99326686 || tv
QQ: 1003423057 || qq
WeChat: jjl1003423057 || wechat
#Google: https://plus.google.com/yourname || google
#Twitter: https://twitter.com/yourname || twitter
#FB Page: https://www.facebook.com/yourname || facebook
#StackOverflow: https://stackoverflow.com/yourname || stack-overflow
#YouTube: https://youtube.com/yourname || youtube
#Instagram: https://instagram.com/yourname || instagram
#Skype: skype:yourname?call|chat || skype
首頁文章摺疊效果
在要摺疊部分的上方添加:
<!-- more -->
在文章末尾添加自定義文字
進入"next/layout/_macor"
新建"passage-end-tag.swig"文件,內容爲:
<div>
{% if not is_index %}
<div style="text-align:center;color: #ccc;font-size:20px;">
#你添加的文字
</div>
{% endif %}
</div>
與上一目錄相同,修改"post.swig"文件,查找
<footer class="post-footer">
在這之上添加:
<div>
{% if not is_index %}
{% include 'passage-end-tag.swig' %}
{% endif %}
</div>
修改主題的配置文件:
在末尾添加:
passage_end_tag:
enabled: true