-
In order to avoid broken links, I need to test if a linked to internal page exists and not link to it if it doesn’t, yet keep the text and style it accordingly. That is, omit the Need it both for Markdown files and Page Loaders. Is there an existing helper function in Framework that I can use? Context: I am generating (a lot of) page names and corresponding links that I know will eventually exist (but not yet). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Short answer is no. The internal function that does this is the For markdown pages, it's quite simple to emulate (just check if the corresponding md file is available); but it's a bit harder if you want to include dynamic paths and page loaders, since the results depend on the configuration ( An alternative possibility, that might be simpler in the end, is to build the whole site, then use the generated files to check whether a given page exists. Or, you could also use the search index ( Or, we could have an option to remove the |
Beta Was this translation helpful? Give feedback.
Short answer is no. The internal function that does this is the
findPage
method on theLoaderResolver
class, but it is not publicly exposed or available in user land.For markdown pages, it's quite simple to emulate (just check if the corresponding md file is available); but it's a bit harder if you want to include dynamic paths and page loaders, since the results depend on the configuration (
interpreters
). In addition, you might want to check if the page's front-matter includes thedraft
key.An alternative possibility, that might be simpler in the end, is to build the whole site, then use the generated files to check wh…