This is the second day of my participation in the More text Challenge. For more details, see more text Challenge

In the process of building a blog with Hexo, I had a problem with the pages being blank for a long time after the categories and tabs were created. Classification and labels can be displayed normally in the TAB bar on the right, but click the navigation bar to enter the classification page, but the content is blank and no error is reported on the console. I even suspect that the classification and label pages need to be manually recorded. Of course that’s not the case. There must be something wrong with my code. Later, I finally found the problem, the original folder and name mapping error, resulting in the theme can not find the classification page code, the following is to introduce you to the classification method and the error I encountered (note: I use the theme volantis, other topics are similar).

Creating a Category folder

Using the hexo new page categories command to create a category After executing this command, the Categories folder containing the index.md file is generated in the Source folderCopy the code

Edit the index.md file in the Categories folder

      ---
      title: categories
      date: 2021-03-25 15:35:01
      type: categories
      layout: category
      comments: false
      ---
Copy the code

The code for the categorize page is very simple, just a few lines above. It is worth noting that the layout value in the categorize file must be the same as the file name of the Layout folder in the current theme. Categories. Later, I found that the subject layout folder I used was category. Ejs instead of Categories.

Declare the article category in the article

When writing articles, write the code “Categories: Category name” in the configuration item in the header of the article page to automatically place the article under one of the categories, which can be arbitrarily named

-- Title: Indicates the title of the articledate: 2021-03-31 16:48:23
       tags: Label namecategories: Category namedescriptionDescription: -Copy the code

Configure the _config.yml file in the theme folder

Go to the _config.yml file in the subject folder, search for the Menu field, set the category URL to ‘/categories’ and the category is set

Click the category in the navigation bar to jump to the category page

The creation method of the TAB page is similar to the classification page, and will not be repeated.

Just started to write a blog, the article has the inadequacies of the place also asks each big man to give advice, hopes to study together with everyone, common progress.