jekyll build personal blog 3

What is the classification of the article display

Below is my display classification Bowen page, you can see this page is page tags in the root directory, the page has two main parts, the upper half is a classification of all articles, as well as the number of articles under each category; below is a list of all articles under each category

mark

We open /tags.html file, as follows

mark

The first time you open this file, it may not understand, html code inside mixed with other code that braces and percent composition, in fact Liquid language, to understand this code, you first have to understand about this language, there are Chinese documents , here is the English document , is actually very simple, takes less than an hour, you will be able to understand the basic grammar

Bowen is the first look at how the directory generated

  • RAW% {%} {% ASSIGN TAGS_LIST = site.tags%} {%}% endraw : tag_list declares a variable, the content is site.tags , site.tags is actually a variable jekyll in, then in the end what is it ? Follows
{"博客"=>[#, #], "笔记"=>[#]}

Blog and notes that the classification of the article, the article will now have two types, one is the blog, the other is the notes, blog following two articles (two # ), the following notes have an article (a # )

  • RAW {%}% {% JB the include / TAGS_LIST endraw%%%} {} : i.e. inserted _includes / JB / tags_list document, we open the file, the main function code is as follows:
{% raw %}{% for tag in tags_list %} 
    <li>
        <a href="{{ BASE_PATH }}{{ site.JB.tags_path }}#{{ tag[0] }}-ref">
        {{ tag[0] }} <span>{{ tag[1].size }}</span>
        </a>
    </li>
{% endfor %}{% endraw %}
  • RAW {%}% {%}% for tag in TAGS_LIST%} {% endraw : looping through tag_list where every piece of content, that the contents tag_list braces above content, it is a tag is a content, such as a first cycles, tag is "博客"=>[#, #], then it is natural tag [0] is the class name, ie 博客, tag [1] .size is the number belongs to the type of blog articles, namely 2article, so the final result is what you see分类+文章数目

Bowen is a list of titles will look at how to generate the

After the above analysis, we know that tag [1] belongs to the set of all articles under the tag label, as long as loops through each article category (tag) and articles under the classification (tag [1]), you can output each article the title of the cycle of each tag code in the blog list above /tags.html that period, circulation contents of all articles under the code of a tag in _includes / JB / pages_list, where the main role is as follows

{% raw %}{% for node in pages_list %}
    <li><a href="{{ BASE_PATH }}{{node.url}}">{{node.title}}</a></li>
{% endfor %}{% endraw %}

How to write a blog post

You only need to add before your markdown article header information , it can be processed into jekyll page can access the header information in the following format:

---
layout : post
title: "jelyll搭建个人博客3"
date: 2019-07-17
tag: 博客
---

Is the header information, layout within the last three dashes of the article to apply the template, and style articles about the show, title is the title of the article Bowen list displayed, if empty, then finally displays the file name, tag when the article is displayed classification category,注意冒号后均有一个空格

Guess you like

Origin www.cnblogs.com/sslogan/p/11201736.html