[components/tooltip][s]: minor adjustment

This commit is contained in:
olayway 2022-05-22 19:52:13 +02:00
parent 40a51ac22b
commit 86c1f8f4cb
1 changed files with 3 additions and 4 deletions

View File

@ -112,12 +112,11 @@ export const Tooltip = ({ render, ...props }) => {
// create a temporary anchor tag to convert relative href to absolute path
const tempLink = document.createElement("a");
tempLink.href = props.href;
// not all notes documents are structured so that the first paragraph will be the content summary
// TBD check if the docs can be adjusted and if previews for notes are even required
if (tempLink.pathname.includes('notes')) {
const filePath = tempLink.pathname.slice(1) // remove slash from the beginning
// disallow tooltips for 'notes' pages for now due to their different structure
if (filePath.includes('notes')) {
return
}
const filePath = tempLink.pathname.slice(1) // remove slash from the beginning
const page = allOtherPages.find(p => p._raw.sourceFilePath === filePath)
content = documentExtract(page.body.raw);
} catch {