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

"internally linking to /, which does not exist" on standard GitHub Pages Jekyll site #661

Closed
DaveSkender opened this issue Nov 22, 2021 · 2 comments

Comments

@DaveSkender
Copy link

DaveSkender commented Nov 22, 2021

I'm getting a false negative error on a GitHub Actions local build, serve, and test of my standard GitHub Pages Jekyll site.

The error (see full log)

- _site/indicators/index.html
*  internally linking to /, which does not exist (line 50)
   <a href="/">
      Stock Indicators
   </a>

From source code

<a href="{{ site.baseurl }}/">
  {{ site.title }}
</a>

Note that instances of {{site.baseurl}}/guide/, for example, resolve okay; this seems to be limited to root /.

The html-proofer (3.19.2) commands (also see full YAML for job):

# GitHub Actions step (after site build and serve on `localhost`)
- name: Test for broken URLs
  working-directory: docs
  run: |
    BUNDLE_GEMFILE="${{github.workspace}}/docs/GemFile" bundle exec htmlproofer \
      --assume-extension \
      --http-status-ignore "403,999" \
      --url-swap "https\://daveskender.github.io/Stock.Indicators:" \ 
      _site

# `url-swap` to remove hard-coded prod domains (there are none)

Previous recommendation (see #542)

You'll have to use the assume-extension option: https://github.com/gjtorikian/html-proofer#using-with-jekyll

The workaround

<!-- use absolute URL with full path to root -->
<a href="{{ '/' | absolute_url }}">
  {{ site.title }}
</a>

<!-- builds in local GitHub Actions as: -->
<a href="http://127.0.0.1:4000/">
  Stock Indicators
</a>

<!-- builds in GitHub Pages as: -->
<a href="https://daveskender.github.io/Stock.Indicators/">
  Stock Indicators
</a>
@DaveSkender
Copy link
Author

Possibly related to:

@gjtorikian
Copy link
Owner

Hi—the next version of HTMLProofer has been completely rewritten and this is no longer a problem. By default, 4.x will add all the assumptions necessary to work with Jekyll (previously these were opt-in; now they are opt-out). I am going to close this issue out, as I'm just one person and can't maintain both the 3.x and 4.x features. ✌️ 4.x should be out within the month. Please reopen if it's still broken!

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

No branches or pull requests

2 participants