-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Inject CMS Content to Razor Components at compile time #50817
Comments
Thanks for contacting us. |
Hi @mouldt. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@mouldt Are you talking about using Blazor as a static site generator that produces static files? Like having markdown files and compile them to pages like some JS framework do? There is no such thing in Blazor. But I guess that someone could create build tasks that could do that. It is not just included in Blazor. If you are looking for prerendering of Blazor WASM pages, then I recommend this: https://github.com/jsakamoto/BlazorWasmPreRendering.Build That is what I'm using for my own webpage which is hosted by GitHub Pages. |
@marinasundstrom - yes exactly that, a static site generator but producing the files from markdown and razor components. These pages are then used as the direct landing page that a user can navigate to, so they render the page quickly, then they hydrate the blazor app in the background and then switch, so you get the best of both worlds. I did look at https://github.com/jsakamoto/BlazorWasmPreRendering.Build |
@mouldt I know that Astro has MDX which is a mix of Markdown and JSX. Blazor does not have that. But it's giving me ideas for enhancing my blog. Feel free to experiment if you want to. Some resources:
You could simply combine these resources - then create a MSBuild task. Of course, there is more to do, like editor experience etc. |
@mouldt thanks for the additional details. We do have support for rendering components outside of the HTTP context, which is the basis for you to build something like that, by rendering from a console app or similar, but we do not offer an out of the box solution for it. |
Thanks for contacting us. We're moving this issue to the |
Closing as a dupe of #51046 |
Hi,
if you use a CMS with your site but the content is mainly static e.g. home, contact, about us etc - how does this fit with Blazor?
With other SPA frameworks e.g. Nuxt.js there are CMS systems that process and inject their content to the pages at build time.
So, for example, you could have a markdown file or a liquid template (index.liquid) NOTE: this could even contain frontmatter to enable add meta tags to the head to improve SEO.
At build time a 'processor' would examine the razor component and replace a tag with the processed content of the CMS file. From then on its just the normal razor compilation.
The benefit, as i see it, is twofold:
Could we have this functionality/experience with Blazor?
The text was updated successfully, but these errors were encountered: