mirror of
https://github.com/ipfs/ipfs-blog.git
synced 2026-08-09 10:22:56 +02:00
account for CANONICAL_BASE config
This commit is contained in:
@@ -6,16 +6,17 @@ export default {
|
||||
const meta = this.$frontmatter.meta
|
||||
const og = meta && meta.find((m) => m.property === 'og:image')
|
||||
if (meta && og) {
|
||||
const ogPath = new URL(og.content, 'http://locahost').pathname
|
||||
const assetPath = normalize(ogPath).replace(/^\/|\/$/g, '')
|
||||
try {
|
||||
const assetPath = normalize(og.content).replace(/^\/|\/$/g, '')
|
||||
const imgPath = require('@source/assets/' + assetPath)
|
||||
const { pageMeta } = this.$ssrContext
|
||||
this.$ssrContext.pageMeta = pageMeta.replace(
|
||||
new RegExp(og.content, 'g'),
|
||||
new RegExp(ogPath, 'g'),
|
||||
imgPath
|
||||
)
|
||||
} catch (e) {
|
||||
throw new Error(`could not load og:image ${og.content}`)
|
||||
throw new Error(`could not load og:image ${ogPath}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user