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

feat: add url_for and relative_url helpers #82

Merged
merged 6 commits into from
Sep 14, 2019

Conversation

curbengh
Copy link
Contributor

@curbengh curbengh commented Sep 11, 2019

using url_for outside of theme can be a bit awkward.

Currently we need

const url_for = hexo.extend.helper.get('url_for').bind(hexo);
// or
const url_for = require('hexo/lib/plugins/helper/url_for').bind(hexo);

With this PR,

const url_for = require('hexo-util').url_for.bind(hexo);

https://github.com/hexojs/site/blob/1d738fb4d7b4f4f89560bb20ec58ca2519848798/source/api/helper.md#how-do-i-use-another-registered-helper-inside-my-custom-helper

https://github.com/hexojs/hexo-renderer-marked/pull/111/files#diff-de043c47b7a14d2d383d220efbaa9c2eR110

Similar goal as #81

@coveralls
Copy link

coveralls commented Sep 11, 2019

Coverage Status

Coverage increased (+0.3%) to 96.364% when pulling 2e376ae on curbengh:url_for-relative into 2de7c15 on hexojs:master.

Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@curbengh curbengh merged commit 76f3319 into hexojs:master Sep 14, 2019
@curbengh curbengh deleted the url_for-relative branch September 14, 2019 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants