How can I tell Hexo to ignore the file when creating messages?
The only solution I found was to include the directory for the post in source
ie source/post
(outside / next to source/_posts
).
Then you can put your assets and reference them in the md file for example.
<script src="/post/js/main.min.js"></script>
Btw, I tried using _config.yml
skip_render
:
skip_render:
- "**/*.js"
- "*/*.js"
- "_posts/post/js/main.min.js"
and other options, but they all result in what main.min.js
appears as a message.
source to share
I had a similar problem, but it was with json files. In my case, all json files will be turned into pages and I don't want them to be. So, I ended up creating a file extend.js
and placing it inside the scripts folder in my theme. Then I included this bit of code.
hexo.extend.filter.register('after_init', function () {
// Remove json files being inserted to db.json -> Pages
var listSync = hexo.extend.renderer.list(true),
listAsync = hexo.extend.renderer.list();
delete listSync.json;
delete listAsync.json;
});
Possible objects that you can delete are htm, html, css, js, json, swig, yml, yaml
. Hope it helps.
source to share