How to add a route for Hexo?

There are two default routes in the _config.yml topic: / and /archieves . Is it possible to add a route, for example /about ?

I tried adding /about to _config.yml, but Cannot GET /about/ shows.

+6
source share
3 answers

You need to create a new page using runnning hexo new page "about" . A folder will be created in source/ . There is a file in this folder called index.md . In this file you can write the contents of this page /about in the markdown method.

This page will appear as a layout. post page , if you want a different layout and style, define in the foreground a layout with layout: YOUR_LAYOUT . Of course, you must create this layout in the layout folder in the theme folder. The layout name will be the file name.

+13
source

If you need about page:

  • run hexo new page "about"

  • You will find the about folder in the source folder. You can edit the index.md file in the about folder.

  • add the About: /about code in the menu section of the _config.yml file in the theme folder. Preview your site :)

+7
source

If you need the about page, you can run the hexo new page 'about' and then add /about in _config.yml

+2
source

Source: https://habr.com/ru/post/984046/


All Articles