I have written a post on hexo.io that outlines how to go about making a hexo tag that gets data from an async file read. Sometimes I might want to write a tag that gets data that is to be used to generate content in a page by way of an async http request. In this post I will be outline how I found a way to go about doing just that. However lately I have found that this is something that I should try to avoid doing actually. In think that hexo should just be used to build from a source folder, and maybe not have much to do with generating that source.
I am on the fence with this. As of late I like the idea of having separate scripts that can be used to update the actual text of my markdown files, rather than writing a hexo tag. Still I have not yet found, or developed a decent software solution for maintaining a large collection of markdown files. For now it would seem that this approach works okay.
So in the scripts folder of my hexo project working tree I have a *.js file called “my-tags.js” which is where I register all the hexo tags for use in my blog posts. In there I have this code that is relevant to this process.
So I am just registering a hexo tag, the only difference is that it is going to have to be an async tag because of the latency with making the request.
That is it for now be sure to check out my other posts on hexo