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

feat(content): add customFilename param to injectContent #597

Merged

Conversation

choyiny
Copy link
Contributor

@choyiny choyiny commented Aug 7, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-plugin-angular
  • vite-plugin-nitro
  • astro-angular
  • create-analog
  • router
  • platform
  • content
  • nx-plugin
  • trpc

What is the current behavior?

Closes #595

What is the new behavior?

injectContent now supports a new argument { customFilename: string } that allows a hardcoded md file to be loaded from /src/content.

Example usage

post$ = injectContent<PostAttributes>({ customFilename: 'index' });

Does this PR introduce a breaking change?

  • Yes
  • No

Previously, if injectContent was used but a slug is not present, it will default to use null.md. Now, not providing a slug will throw an Error. Although breaking, this does not seem like intended behavior anyways.

Other information

[optional] What gif best describes this PR or how it makes you feel?

@netlify
Copy link

netlify bot commented Aug 7, 2023

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 4d5f611
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/64d1a625da300a0008337940
😎 Deploy Preview https://deploy-preview-597--analog-docs.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.

@netlify
Copy link

netlify bot commented Aug 7, 2023

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 4d5f611
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/64d1a62599fcc500089133a3
😎 Deploy Preview https://deploy-preview-597--analog-app.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.

@netlify
Copy link

netlify bot commented Aug 7, 2023

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 4d5f611
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/64d1a626906b5f00083c29e9
😎 Deploy Preview https://deploy-preview-597--analog-blog.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.

@choyiny choyiny force-pushed the inject-content-custom-filename branch from 20e5752 to edf92c0 Compare August 7, 2023 21:10
@choyiny choyiny changed the title feat: add customFilename param to injectContent feat(content): add customFilename param to injectContent Aug 7, 2023
Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs tweaks

apps/docs-app/docs/features/routing/content.md Outdated Show resolved Hide resolved
apps/docs-app/docs/features/routing/content.md Outdated Show resolved Hide resolved
apps/docs-app/docs/features/routing/content.md Outdated Show resolved Hide resolved
apps/docs-app/docs/features/routing/content.md Outdated Show resolved Hide resolved
apps/docs-app/docs/features/routing/content.md Outdated Show resolved Hide resolved
@choyiny choyiny force-pushed the inject-content-custom-filename branch from d397a84 to beb8766 Compare August 8, 2023 02:16
@choyiny choyiny force-pushed the inject-content-custom-filename branch from beb8766 to 4d5f611 Compare August 8, 2023 02:19
@brandonroberts brandonroberts merged commit 4f3dd68 into analogjs:main Aug 8, 2023
19 checks passed
@choyiny choyiny deleted the inject-content-custom-filename branch August 8, 2023 19:50
Villanuevand pushed a commit to Villanuevand/analog that referenced this pull request Sep 12, 2023
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.

injectContent should support both dynamic files or hardcoded files
2 participants