This request is on the roadmap for Hexo 4.0. It hasn't been implemented yet (at the time of writing this answer).
In the issue above, sapegin gave a workaround using a custom helper:
hexo.extend.helper.register('page_url', function(path, options) {
return this.url_for(path, options).replace(/index\.html$/, '');
});
If you place this helper in a file like scripts/helpers.js
, you can then use it in your posts and pages:
<%= page_url(page.path) %>
It's not as nice as a built-in variable, but it works.