Hexo - Adding Links to Other Hexo Pages

The categories does quite well at grouping together pages. But sometimes I’d like my page to link to another page. This is done using a Tag-Plugin called Post_Link

To link to another page in your hexo page stack, use the following structure:

1
{% post_link VB-Net-FileSystemWatcher [VB.Net - FileSystemWatcher] %}  

Arguments

  • Brace/Parens - surrounds what are called Tag-Plugins. They are very poorly documented but seem to work.
  • Post_link – is a command telling Hexo to turn this into a link to another hexo page. This is a Tag-Plugin. There are quite a few
  • VB-Net-FileSystemWatcher – is a file we are linking to
  • [VB.Net – FileSystemWatcher] - is a title, or link description. The Brackets are not required..

What about spaces ?
A statement like this

1
* {% post_link SQL Server - Select - Cross Apply [SQL Server - Select - Cross Apply] %}  

When you do a “hexo server” you’ll get a vague error message:

1
2
3
4
5
6
7
8
PS E:\d\dev\hexo\MarklandK> hexo server
INFO Validating config
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Template render error: (unknown path)
Error: Post not found: post_link SQL.
at Object._prettifyError (E:\d\dev\hexo\MarklandK\node_modules\nunjucks\src\lib.js:32:11)
:

The solution the first argument of post_link should match the filename, not the title. For example

1
2
* {% post_link SQL-Server-Select-Cross-Apply [SQL Server - Select - Cross Apply] %}  
* {% post_link SQL-Server-Select-ForXmlPath [SQL Server - Select - Select - ForXmlPath] %}

References