Skip to content

feat: allow custom src/pages/index.astro #93

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

Merged
merged 6 commits into from
Jun 28, 2024
Merged

Conversation

Nemikolh
Copy link
Member

@Nemikolh Nemikolh commented Jun 24, 2024

This PR makes it possible to have a custom src/pages/index.astro by modifying the defaultRoutes to support an extra mode in which it does not inject the default route for /{base}.

Once this PR is merged, to enable this feature on a project, one would have to do:

import tutorialkit from '@tutorialkit/astro';
import { defineConfig } from 'astro/config';

export default defineConfig({
  integrations: [
    tutorialkit({
      // only enable the routes for the tutorial
      defaultRoutes: 'tutorial-only',
    }),
  ],
});

The alternative to this I considered was to modify index.astro so that it reads file from the src/pages/index.astro folder, however this wouldn't have worked under the eject mode as the file would end up reading itself recursively.

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Jun 24, 2024

⚠️ No Changeset found

Latest commit: 23ceb9d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

cloudflare-workers-and-pages bot commented Jun 25, 2024

Deploying tutorialkit-demo-page with  Cloudflare Pages  Cloudflare Pages

Latest commit: 23ceb9d
Status: ✅  Deploy successful!
Preview URL: https://6f733e44.tutorialkit-demo-page.pages.dev
Branch Preview URL: https://joan-default-route.tutorialkit-demo-page.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented Jun 25, 2024

Deploying tutorialkit-docs-page with  Cloudflare Pages  Cloudflare Pages

Latest commit: 23ceb9d
Status: ✅  Deploy successful!
Preview URL: https://e0110403.tutorialkit-docs-page.pages.dev
Branch Preview URL: https://joan-default-route.tutorialkit-docs-page.pages.dev

View logs

@d3lm
Copy link
Contributor

d3lm commented Jun 26, 2024

When adding these things we need to make sure to add this to the docs as well and it'd be great if we can link the docs PR here as well for full transparency.

@SamVerschueren
Copy link
Contributor

it'd be great if we can link the docs PR here as well for full transparency.

It'd be better to just update the docs in this PR. So it's a single PR which includes everything.

@d3lm
Copy link
Contributor

d3lm commented Jun 26, 2024

Right! Forgot for a second that the docs are in the same repo 🤦‍♂️

@Nemikolh
Copy link
Member Author

Nemikolh commented Jun 26, 2024

@d3lm, @SamVerschueren I've updated the JSDoc of the property so that the new value is explained.

Given we currently don't have any docs on https://tutorialkit.dev for our JSDocs I don't think it makes sense that I introduce that as part of this PR?

What do you think?

@Nemikolh Nemikolh merged commit d431d4d into main Jun 28, 2024
9 checks passed
@Nemikolh Nemikolh deleted the joan/default-route branch June 28, 2024 08:38
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