Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken link checker #161

Merged
merged 16 commits into from
Nov 27, 2024
Merged

Broken link checker #161

merged 16 commits into from
Nov 27, 2024

Conversation

fabianrbz
Copy link
Collaborator

@fabianrbz fabianrbz commented Nov 25, 2024

Add broken-link checks

  • Full scan scheduled every Sunday
  • PR scan scoped to the pages that were added/changedas part of a PR

How to run it:
cd into the tool's folder and install the dependencies.

cd tools/broken-link-checker
npm ci
  • Full scan node full.js --host http://localhost:8888
  • Local scan, can be scoped to specific source files, e.g.
node run.js  --files 'app/_landing_pages/**/*.yaml' --files 'app/**/*.md' --ignore github.com

NOTES:

  • The check needs the site to be built/run as a prereq
  • A new Jekyll generator creates a json file (not in production) containing source files to url mappings based on the relative_path attribute. The check relies on this file to know which urls to check when running locally or in pr mode.
  • There are 3 config files
    • ignored_targets.json: Links the check should ignore, e.g. http://localhost:8000, social media links, etc.
    • ignored_paths.json: Empty for now, it should include relative URLs the check should ignore.
    • ignored_placeholder_paths.json: Relative URLs that we currently link to but do not yet have corresponding pages for.

of the source files and their corresponding URLs.

This doesn't run in production.
It runs in three different ways:
* Full site scan
* Run a check against the pages generated by specific source files
* PR mode: same as the above, but it pulls the list of files from the
  pull request.

It relies on a file generated by the site after build, which contains a
hash that maps all the source files used by Jekyll to generated pages
and the corresponding URLs.

The check can then fetch the urls it needs to check based on the source
files provided (either manually or pulled from the PR) and run
broken-link-checker against those.
have the broken link checker ignore them for now
Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for kongdeveloper ready!

Name Link
🔨 Latest commit f3ee6d6
🔍 Latest deploy log https://app.netlify.com/sites/kongdeveloper/deploys/67445941bb836d00081cd0a1
😎 Deploy Preview https://deploy-preview-161--kongdeveloper.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@fabianrbz fabianrbz marked this pull request as ready for review November 25, 2024 10:43
@fabianrbz fabianrbz requested a review from a team as a code owner November 25, 2024 10:43
@fabianrbz
Copy link
Collaborator Author

fabianrbz commented Nov 25, 2024

Screenshot 2024-11-25 at 12 01 11

@fabianrbz fabianrbz merged commit fb0c0d3 into main Nov 27, 2024
10 checks passed
@fabianrbz fabianrbz deleted the broken-link-checker branch November 27, 2024 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant