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

Add top-level index.html for dev only (not GH Pages / W3C site) #4076

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

kfranqueiro
Copy link
Contributor

The Eleventy build and dev server populates subdirectories, but does not create a top-level index.html, which leads to a 404 when you follow the link output to the console by the dev server, or output in PR comments by Netlify. This has already caused confusion for a number of folks.

I initially avoided adding a top-level index page to avoid complications with regard to publishing to GitHub Pages and the W3C Site, but since it's come up a few times and been specifically requested I discussed it with Kevin yesterday and spent some time today working on solving it while keeping it clear of the deployment/publication cases.

Changes

  • Adds extremely simple top-level index.html
  • Updates .eleventyignore to allow for top-level HTML files, while still ignoring top-level files that shouldn't be built
  • Adds condition to CustomLiquid.ts to avoid processing pages outside of techniques or understanding
  • Adds considerations to the Eleventy config when targeting GH Pages or w3.org, to clear any preexisting output folder and to avoid outputting top-level index.html

@w3cbot
Copy link

w3cbot commented Sep 19, 2024

kfranqueiro marked as non substantive for IPR from ash-nazg.

Copy link

netlify bot commented Sep 19, 2024

Deploy Preview for wcag2 ready!

Name Link
🔨 Latest commit 571515c
🔍 Latest deploy log https://app.netlify.com/sites/wcag2/deploys/66ecadeff642c20009de30af
😎 Deploy Preview https://deploy-preview-4076--wcag2.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.

@kfranqueiro kfranqueiro merged commit e4469d7 into main Sep 20, 2024
5 checks passed
@kfranqueiro kfranqueiro deleted the kgf-top-level-index-for-dev branch September 20, 2024 14:33
kfranqueiro added a commit that referenced this pull request Sep 20, 2024
kfranqueiro added a commit that referenced this pull request Sep 20, 2024
This reverts commit e4469d7.

There was an unforeseen issue affecting the GH Pages deploy script,
which I will need to dig into and test separately. Reverting first so we
can get those deploys working for now.

Sorry for the noise!
kfranqueiro added a commit that referenced this pull request Oct 3, 2024
This is a re-do of #4076, with one change: it only pre-clears the output
folder (`_site`) for W3C site builds, not for GitHub Pages builds. The
deploy script for the latter depends on the output folder _not_ being
cleared, in order to layer the new build on top of existing contents.
(Fortunately this failed loudly the first time upon deploy, so it didn't
affect the contents of the gh-pages branch.)

I tested using my own fork this time to make sure the
GitHub Pages build would complete, and confirmed that
the top-level index.html added in this PR does _not_ output for that build,
leaving the existing top-level index.html in the gh-pages branch intact.
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.

3 participants