Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Allow templates to get assets referenced in a post and their order #2158

Closed
xunnanxu opened this issue Sep 12, 2016 · 1 comment
Labels
stale wontfix This will not be worked on

Comments

@xunnanxu
Copy link

Environment Info

Hexo version 3.2.2

Plugin version(npm ls --depth 0)

+-- hexo@3.2.2
+-- hexo-deployer-git@0.2.0
+-- hexo-generator-archive@0.1.4
+-- hexo-generator-category@0.1.3
+-- hexo-generator-feed@1.2.0
+-- hexo-generator-index@0.2.0
+-- hexo-generator-tag@0.2.0
+-- hexo-renderer-ejs@0.2.0
+-- hexo-renderer-marked@0.2.11
+-- hexo-renderer-stylus@0.3.1
+-- hexo-server@0.2.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:

var link = post.thumbnail;
if (hasTagPlugin(link)) {
  link = Tag.eval(link);
}  // link = '/url/to/post/blah.png'
@stale stale bot added the wontfix This will not be worked on label Sep 27, 2017
@stale
Copy link

stale bot commented Nov 26, 2017

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.

@stale stale bot added the stale label Nov 26, 2017
@stale stale bot closed this as completed Dec 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant