Skip to content

Commit 8534b65

Browse files
committed
Fix issue if a tag has an id attribute but no href
1 parent 32aceb4 commit 8534b65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎lib/ghost-normalize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const withRewriteGhostLinks =
6262
(cmsUrl: UrlWithStringQuery, basePath = '/') =>
6363
(htmlAst: Node) => {
6464
visit(htmlAst, { tagName: `a` }, (node: LinkElement) => {
65-
if (!node.properties) return
65+
if (!node.properties || !node.properties.href) return
6666
const href = urlParse(node.properties.href)
6767
if (href.protocol === cmsUrl.protocol && href.host === cmsUrl.host) {
6868
node.properties.href = basePath + href.pathname?.substring(1)

0 commit comments

Comments
 (0)