Skip to content

feat: add url_for and relative_url helpers#82

Merged
curbengh merged 6 commits intohexojs:masterfrom
curbengh:url_for-relative
Sep 14, 2019
Merged

feat: add url_for and relative_url helpers#82
curbengh merged 6 commits intohexojs:masterfrom
curbengh:url_for-relative

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