Handle Internal link with hashtag('#')
This commit is contained in:
parent
40a947e2ea
commit
6f027aeb8e
@ -134,12 +134,20 @@ export const Transformer = {
|
||||
|
||||
// let name = [Transformer.parseFileNameFromPath(pageName)];
|
||||
|
||||
//TODO: Handle # Link
|
||||
let slug = Transformer.parseFileNameFromPath(pageName);
|
||||
if (slug.includes('#')) {
|
||||
console.log(slug)
|
||||
let canonicalSlug;
|
||||
if (pageName.includes('#')) {
|
||||
console.log(pageName)
|
||||
const tempSlug = pageName.split('#')[0]
|
||||
if (tempSlug.length === 0) {
|
||||
// Meaning it in form of #Heading1 --> slug will be this file slug
|
||||
canonicalSlug = toSlug(aFilePath)
|
||||
} else {
|
||||
canonicalSlug =Transformer.pageResolver(tempSlug)[0].split('#')[0]
|
||||
}
|
||||
} else {
|
||||
canonicalSlug = Transformer.pageResolver(pageName)[0].split('#')[0]
|
||||
}
|
||||
const canonicalSlug = Transformer.pageResolver(pageName)[0]
|
||||
|
||||
|
||||
const backLink = {
|
||||
title: Transformer.parseFileNameFromPath(toFilePath(canonicalSlug)),
|
||||
|
Loading…
Reference in New Issue
Block a user