Skip to content

Test if internal linked to page exists #1858

Answered by Fil
Martien asked this question in Q&A
Discussion options

You must be logged in to vote

Is there an existing helper function in Framework that I can use?

Short answer is no. The internal function that does this is the findPage method on the LoaderResolver 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 the draft 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…

Replies: 1 comment 1 reply

Comment options

Fil
Dec 2, 2024
Collaborator

You must be logged in to vote
1 reply
@Martien
Comment options

Answer selected by Fil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants