Hexo blog Next question template
Recent studies and build a Hexo blog, after testing several templates, and finally with the Next well-known of. However, Next template has several problems, said here about.
First talk about, Next I use a template version 5.1.4 and 6.4.0. The latter, before I wrote this article last 10 days update, released than the release of the new version.
(A) Menu big bug
Both versions of the templates are present this bug, which indicates that the official has not been repaired. Submitted the relevant issue at github someone, so I will not repeat submission.
1.bug feature
(1) In _config.yml document templates folder, use the default settings in the Menu at:
home:/archives:/archives/about:/about/......
Or amended as follows:
home:/archives: archives/about: about/......
Open the home page, the page display properly. However, if you click on archives, about the menu and so on, will only refresh the home page, other pages can not be opened.
(2) if the following settings:
home:/archives:/archives about:/about ......
or
home:/archives: archives about: about ......
Open the home page, the page display properly. Click archives, you can enter the archives page. At this time, if we click on the home page, enter or archives page; if this time click on the about menu will attempt to open the archives/about.
2.bug repair
To address this problem, you can fix the following ways:
(1) For version 5.1.4, open /layout/_partials/header.swig, line 43:
a href = {{url_for (path.split ( `||`) [0]) | trim}} rel = section
Changed
a href = {{path.split ( `||`) [0] | trim}} rel = section
To a temporary repair.
(2) for version 6.4.0, open layout/_macro/menu/menu-item.swig, line 6:
a href = {{url_for (itemURL)}} rel = section
change into
a href = {{itemURL}} rel = section
To a temporary repair.
(B) Comments Home is always 0 and articles page does not display the number of comments
In _config.yml in addition Valine, other comments have set a count option, this is the home page to display the number of comments: used to count, except Valine not have this feature. In this case the number is always 0 comments Home, pages Comments not appear, but as the number of comments: I do not currently know how to fix, only the number of comments: 0 and comments: kill. 6.4.0 In an example, the position of the code is layout/_macro/post.swig, 147 ~ 208 lines, comments about the count code is as follows:
{?f post.comments?{?f theme.facebook_comments_plugin.enable?span class = post-comments-count span class = post-meta-divider |/span span class = post-meta-item-icon i class = fa fa-comment-o/i/span a href = {{url_for (post.path)}} # comments itemprop = discussionUrl span class = post-meta-item-text {{__ ( `post.comments_count`) + __ ( `symbol.colon`)}}/span span class = post-comments-count fb-comments-count data-href = {{post.permalink}} itemprop = commentCount0/span/a/span {?lseif theme.disqus .enable and theme.disqus.count?span class = post-comments-count span class = post-meta-divider |/span span class = post-meta-item-icon i class = fa fa-comment-o/i/span a href = {{url_for (post.path)}} # comments itemprop = discussionUrl {?f __ ( `disqus`) ==` disqus` -!?span class = post-meta-item-text {{ __ ( `post.comments_count`) + __ (` symbol.colon`)}}/span {?ndif?span class = post-comments-count disqus-comment-count data-disqus-identifier = {{post.path }} itemprop = commentCount/span/a/span {?lseif theme.chan gyan.enable and theme.changyan.appid and theme.changyan.appkey?span class = post-comments-count span class = post-meta-divider |/span span class = post-meta-item-icon i class = fa fa-comment-o/i/span {?f is_post ()?a href = {{url_for (post.path)}} # SOHUCS itemprop = discussionUrl span class = post-meta-item-text {{__ ( ` post.comments_count`) + __ ( `symbol.colon`)}}/span span id = changyan_count_unit class = post-comments-count hc-comment-count data-xid = {{post.path}} itemprop = commentsCount/span/a {?lse?a href = {{url_for (post.path)}} # SOHUCS itemprop = discussionUrl span class = post-meta-item-text {{__ ( `post.comments_count`) + __ (` symbol .colon`)}}/span span id = url :: {{post.permalink}} class = cy_cmt_count data-xid = {{post.path}} itemprop = commentsCount/span/a {?ndif?{?lseif is_post () and theme.gitment.enable and theme.gitment.mint and theme.gitment.count?span class = post-comments-count span class = post-meta-divider |/span span class = post-meta-item -icon i class = fa fa-comment-o/i/span a href = {{url_for (post.path)}} # comments itemprop = discussionUrl span class = post-meta-item-text {{__ ( `post.comments_count`) + __ (` symbol.colon`)}}/span span class = post-comments-count gitment-comments-count data-xid = {{url_for (post.path)}} itemprop = commentsCount/span/a/span {?lseif theme.valine.enable and theme.valine.appid and theme.valine.appkey?span class = post-comments-count span class = post-meta-divider |/span span class = post-meta-item-icon i class = fa fa-comment-o/i/span a href = {{url_for (post.path)}} # comments itemprop = discussionUrl span class = post-meta-item-text {{__ ( `post.comments_count`) + __ (` symbol.colon`)}}/span span class = post-comments-count valine-comment-count data-xid = {{url_for (post.path)}} itemprop = commentCount/span/a/span {?ndif?{?ndif?rIf you do not switch to other comment systems, then put this code to kill, Home will not show Comments: 0, pages will not display the number of comments: a.
Display and hyperlinks (c) sidebar classification, labeling
If no text classification, the label is not inserted, the sidebar is not displayed classification and labeling.
If you set the text classification, insert labels, the sidebar displays the classification and labeling, and display information about the number, but there is no classification and labeling hyperlinks.
To give it a hyperlink, the need to create categories and tags page. Index.md in two files, are written into the following code:
(1) categories page:
--- title: All Categories date: 2018-08-18 07:58:05 type: categories ---
(2) tags page
--- title: All tags date: 2018-08-18 07:55:47 type: tags ---
The above two codes, the following --- not need to write any text. What title is written at what the page is displayed. Then _config.yml, delete categories and in front of the tags #.
Thus, the new categories and tags page. Sidebar classification and labeling will have a hyperlink, respectively link to two pages.
I do not have too many features enabled, so only encounter these problems.
(D) adding Disqus
As we all know, for some reason, Disqus is DNS poisoning, so I can not access in the territory of North Korea. But it is the world's best with a third-party commenting system, not one. Hexo blog use Disqus PHP API to achieve temporary walls message function, the whole process is a series of code sets, code recording will now change as follows.
NOTE: The following code is added to the subject of the file Next 6.4.0.
(1) establish Comments
In/layout/_third-party/comments under the new disqusapi.swig, write the following:
{?f theme.disqusapi.enable?{?f page.comments?link rel = stylesheet href = // path /iDisqus.min.css/script src=// path /iDisqus.min.js/script script var disq = new iDisqus ( 'comments', {forum:' {{theme.disqusapi.forum}} ', site:' {{theme.disqusapi.site}} ', api:' {{theme.disqusapi.api}} ', mode: {{theme.disqusapi.mode}}, badge:' {{theme.disqusapi.badge}} ', timeout: {{theme.disqusapi.timeout}}, init: true, identifier:' {{page .path}} '}); disq.count ();/script {?ndif?{?ndif?rIn index.swig same folder write:
{?nclude 'disqusapi.swig'?rIn /layout/_partials/comments.swig, and finally a front {?ndif? write the following code:
{?lseif theme.disqusapi.enable?div id = comments/div {?ndif?rIn _config.yml theme inside, comment on setting the original Disqus and join the new settings:
# Disqus # disqus: #enable: false #shortname: #count: true #lazyload: false # Disqus APi disqusapi: enable: true forum: '' // here to fill in the site settings Disqus corresponding shortname site: 'https: // '// If you have turned on https, here must write https. Authors will be fixed later said the issue api: '' // here api URL mode: 1 // api here by the Readme fill badge: 'bloggers' timeout: 1000 // here to fill in the Readme by api
When setting up a reverse proxy, css and js in the path was inaccessible, appeared 403 tips. Then the need for the folder "reset owner", delete the following .htaccess file (if any), will be a normal visit.
(2) increase tips
In/layout/_macro following new passage-end-tag.swig, write the following:
div {?f not is_index?div style = text-align: center; color: # 636363; font-size: 15pxbr/use this blog Disqus comment system, currently being realized walls message function. If you can not display a comment box, please use proxy access. br // div {?ndif?/ div
Post.swig in the same folder, locate the following code:
{?et isLast = loop.index?age.per_page === 0?{?f is_index and not isLast?div class = post-eof/div {?ndif?rThe following code is added to the front of it:
div {?f not is_index?{?nclude 'passage-end-tag.swig'?{?ndif?/ div
_Config.yml in the theme file, add the following:
# End of Text prompt passage_end_tag: enabled: true
The other is to build a reverse proxy. Needs outside the host, there is PHP 5.6+ environment, binding domain, you can see the official Readme. Build process has been helped author Fooleap, and to express my gratitude.
Finally, I put my Hexo blog link: Click to visit. If you find a link to access this page is not Hexo blog, or can not access, it shows that this Hexo blog is no longer maintained or domain name expired.
Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/Hexo-blog-Next-question-template.htm