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

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

This comment has been minimized.

Copy link

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.

@curbengh curbengh force-pushed the curbengh:url_for-relative branch from 270054f to 2e376ae Sep 14, 2019
@curbengh curbengh requested a review from SukkaW Sep 14, 2019
@SukkaW
SukkaW approved these changes Sep 14, 2019
Copy link
Member

left a comment

LGTM!

@curbengh curbengh merged commit 76f3319 into hexojs:master Sep 14, 2019
3 checks passed
3 checks passed
Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
coverage/coveralls Coverage increased (+0.3%) to 96.364%
Details
@curbengh curbengh deleted the curbengh:url_for-relative branch Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.