You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow templates to get assets referenced in a post and their order
Use Case
Right now templates don't know what assets are used in posts (e.g. those referenced by asset_img). It would be nice if we can keep a record of asset reference calls and their order. That way, a template can auto generate the thumbnail for a post from the first referenced image asset, for example.
Note this might be against the design since it would require tag plugins to have side effects. An alternative may be is to let template code to trigger tag plugin code in post front-matter, e.g.:
thumbnail: <% asset_img blah.png %>
Template code:
var link = post.thumbnail;
if (hasTagPlugin(link)) {
link = Tag.eval(link);
} // link = '/url/to/post/blah.png'
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Environment Info
Hexo version 3.2.2
Plugin version(
npm ls --depth 0
)Feature Request
Allow templates to get assets referenced in a post and their order
Use Case
Right now templates don't know what assets are used in posts (e.g. those referenced by
asset_img
). It would be nice if we can keep a record of asset reference calls and their order. That way, a template can auto generate the thumbnail for a post from the first referenced image asset, for example.Note this might be against the design since it would require tag plugins to have side effects. An alternative may be is to let template code to trigger tag plugin code in post front-matter, e.g.:
thumbnail: <% asset_img blah.png %>
Template code:
The text was updated successfully, but these errors were encountered: