Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell Hexo to ignore a file when creating posts?

Tags:

hexo

In source/_posts I have post.md and post/ directory to hold assets for post.md.

In post/ I have js/main.min.js which is being used in post.md to illustrate something.

Hexo is picking up the main.min.js and creating a post for it. How can I get around this?

like image 533
justin Avatar asked Dec 24 '22 16:12

justin


1 Answers

The only solution I have found was to include a directory for the post under source i.e. source/post (outside / alongside source/_posts).

You can then put your assets there and refer to them in md file e.g.

<script src="/post/js/main.min.js"></script>

Btw, I have tried using _config.yml's skip_render:

skip_render:
  - "**/*.js"
  - "*/*.js"
  - "_posts/post/js/main.min.js"

and other variations but they all result in main.min.js being rendered as a post.

like image 132
justin Avatar answered Mar 05 '23 22:03

justin