【NexT】NexT upgrade related

NexT related

I have nothing to do today, and found that NexT has been updated to 7.8.0, and the blog I just set up a few days ago is still version 5.1, and a hundred thousand alpacas whizzed by in my heart. . . Although very reluctant, but in line with the attitude of both early and late students, I decided to make a fuss and upgrade. . . I would like to use this article to commemorate the big pits I encountered during the upgrade process.

Pitfalls encountered by NexT from 5.1.x --> 7.8.0

The upgrade process is actually very simple, just clone it directly from github. For details, you can refer to the official document , which will not be elaborated here. Just talk about the pits you encountered!

  • The displayed font becomes Devanagari? ?

    In fact, this problem is caused by not reading the official documents carefully. . In the 5.1 version, the Chinese setting is called zh-Hans, in the new version, the Chinese should be set to zh-CN. Just refresh after that, if there is no effect, clean it first, and then display Chinese normally.

  • The shadow effect added to the article is missing

In version 5.1, the original style can be overwritten by modifying custom.styl under _custom, but in the new version, the directory structure has changed, which makes this method invalid, so it can only be realized by other means. Then in the theme configuration file, the following configuration can be found:
configuration file

We remove the comment from the line circled by the red frame, and then create a new _data directory in the source directory under the root directory of the site, and then create a new styles.styl. At this point, I thought it was a success. I copied the previous code and found it was still useless. . . Later, it was found that because the style name had changed, it needed to be rewritten. The following is the added code

.use-motion {
	if (hexo-config('motion.transition.post_block')) {
		.post-block {
		   opacity: 0;
		   margin-top: 60px;
		   margin-bottom: 60px;
		   padding: 25px;
		   -webkit-box-shadow: 0 0 5px rgba(202, 203, 203, .5);
		   -moz-box-shadow: 0 0 5px rgba(202, 203, 204, .5);
		}
		.pagination, .comments {
			opacity: 0;
		}
	}
}

Then execute hexo clean & hexo s , you can see the disappearing shadow box reappear locally.

  • The function of sticking to the top of the article

This function is actually good, just like version 5.1, directly modify post.swig in the themes*\layout\_macro directory

Locate under the div class="post-meta" tag and insert the following code:

{% if post.top %}
    <i class="fa fa-thumb-tack"></i>
    <font color=green>置顶</font>
    <span class="post-meta-divider">|</span>
{% endif %}

Then save and refresh to see the effect. (First install the hexo-generator-index-pin-top plugin, and uninstall the original hexo-generator-index plugin)

  • Add article read mark

This function is actually the same as the old version and has not been changed. \themes\*\layout\_macroCreate a new file in passage-end-tag.swigand add the following code

<div>
    {% if not is_index %}
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------已经触及底线啦<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    {% endif %}
</div>

Then in the statistics directory, modify post.swig, add the following code post-bodyafter and before:END POST BODY

<div>
  {% if not is_index %}
    {% include 'passage-end-tag.swig' %}
  {% endif %}
</div>

Finally, in the theme configuration file , add the following configuration:

passage_end_tag:
  enabled: true

In this way, the reading end tag can be realized ==

  • No garlic is not displayed

    In the updated version 7.8, there is a setting about no garlic. After setting it to true, the number of visitors is still not displayed. After baidu, it is found that there is an error in calling the api, but after checking, it is found that the api is not wrong. . . So after turning on the developer mode, I found out that there is no garlic data, but display:none is added after the style. . . So the style doesn't show up. Then themes\your_theme\layout\_third-party\statisticsopen busuanzi-counter.swig and themes\your_theme\layout\_macropost.swig in the directory, and found the style, as shown in the figure:
    style file
    style file

    Then directly modify the style to "display: inline-flex;", restart, and sure enough, the home page data comes out, but when you click on the specific article page, there is still no access statistics. . . Really speechless, simply add the following code in the previously added custom style file styles.styl to forcibly override the CSS style:
    insert image description here

    Then execute hexo clean & hexo s, clear the cache, and you can see the data display ~ finally succeeded, it is really cheating. .

    The effect is as follows:


I have encountered these problems so far, if I encounter new problems, I will add an update~


2022.3.20 Additional update

## Set hidden articles

Modify index.swig under themes\next7\layout

Add notshow: true at the beginning of the article, and it should work.

PS: This article is also updated on the personal blog

Guess you like

Origin blog.csdn.net/weixin_39524208/article/details/124981319