Permalink is not reflected
Description
Autometa has not catch the rewritten by another extended function.
This problem may be a problem to be solved by the Vuepress core in the future, such as setting the execution order of plugins.
What do you think about this problem?
Temporary solution
before
module.exports = ( plugin_options, context ) => ({
extendPageData ( $page ) {
const { frontmatter } = $page;
...
after
module.exports = ( plugin_options, context ) => ({
ready () {
const { pages } = context
pages.forEach( page => {
const { frontmatter } = page;
...
Expected Behavior
/about.md
---
title: Hello
permalink: about-page
---
# About
output
/about-page/index.html
<!DOCTYPE html>
<head>
<meta name="twitter:url" content="https://example.com/about-page/">
...
Actual Behavior
/about.md
---
title: Hello
permalink: about-page
---
# About
output
/about-page/index.html
<!DOCTYPE html>
<head>
<meta name="twitter:url" content="https://example.com/about.html">
...
Your Environment
- vuepress-plugin-autometa version: 0.1.10
- vuepress version: 1.0.0-alpha.40
- node version: 10.7.0
- npm version: 6.6.0
- OS: MacOS 10.14.2
sorry, I'm using translation. love this plugin. thanks!
Thank you @tmiame for the feedback!
Here's what I think:
- is the other extended function done with another plugin, and if so, have you tried adding
autometaplugin after it? - using your temporary solution of using the
readyhook function would not be enough to get all$pageproperties, in paticular$page._strippedContentwhich is only available inextendPageData- this is something that I had to deal with invuepress-plugin-feed - overriding default
$page.pathwith$page.frontmatter.permalinkor$page.frontmatter.autometa.pathseems the best option in this case; requires updating thePLUGIN.get_canonical_url()
Only autometa is added. Permalink is built into the core. my config is here
// theme/index.js
const autometa_options = {
canonical_base: 'https://example.com'
}
module.exports = {
plugins: [
[ 'autometa', autometa_options ]
]
}
- using your temporary solution of using the
readyhook function would not be enough to get all$pageproperties, in paticular$page._strippedContentwhich is only available inextendPageData- this is something that I had to deal with invuepress-plugin-feed
It was very helpful. Thank you.
I agree. Because there are times when there are variables in the permalink'/:year/:month/:day/:slug', I think that it is better to use the getPermalink method of shared-utils.
Thanks for clarifying it.
I'll take a look and see if it can be implemented and the best way to do so.
#8 would fix this