Comments (13)
As I statically generate my site, I want them to be generated during build time also, not on client side. At the moment I can achieve it only with server page. Is there any other way you will suggest to deal with static generation of content from headless CMS ?
from analog.
I see, so you're just using the markdown component with loading your own content. You can try adding this to your bootstrap providers in the app.config.ts
// ... other imports
import { ContentRenderer, MarkdownContentRendererService } from '@analogjs/content';
export const appConfig: ApplicationConfig = {
providers: [
// ... other providers
provideContent(
withMarkdownRenderer({
loadMermaid: () => import('mermaid'),
}),
withPrismHighlighter()
),
{ provide: ContentRenderer, useClass: MarkdownContentRendererService }
],
};
from analog.
Now it works
Only the code highlighter is not working ))
from analog.
Add these imports
to your app.config.ts
import 'prismjs/components/prism-bash';
import 'prismjs/components/prism-css';
import 'prismjs/components/prism-javascript';
import 'prismjs/components/prism-json';
import 'prismjs/components/prism-markup';
import 'prismjs/components/prism-typescript';
from analog.
I think make sens to add it into instructions, otherwise it is confusing how to integrate with syntax highlights .
Same for providers, make sense to add it to content providers, what is the sens to initiate content provider and separately markdown service
from analog.
@alexcibotari In 1.6, we introduced build-time markdown rendering and syntax highlighting, so it doesn't need to be done client-side.
If you were using injectContent
and not pulling from a CMS, it works just the same without the manual imports.
We can add some instructions for those who want to do rendering/syntax highlighting client-side.
from analog.
As I statically generate my site, I want them to be generated during build time also, not on client side. At the moment I can achieve it only with server page. Is there any other way you will suggest to deal with static generation of content from headless CMS ?
Yes, we can add some guidance on using a headless CMS. Do you have an example repo using a headless CMS?
from analog.
I can add you to one of my repositories for a website with Headless CMS integration. Also, based on your guidance I can create a public example to share with everyone.
from analog.
👍
from analog.
Done. I wrote an email, just in case it will require me to share some private information.
from analog.
I found out that without adding MarkedSetupService
in providers it will not work.
At the same time, the UI is flickering after refresh
You can check it here : https://localess.org/docs/sdk/typescript
from analog.
@alexcibotari I released a patch version with a fix for the flickering 1.6.2-beta.2
. You can set up these providers for client side rendering and syntax highlighting.
providers: [
MarkedSetupService,
provideContent(
withMarkdownRenderer({
loadMermaid: () => import('mermaid'),
}),
withHighlighter({ useClass: PrismHighlighter })
),
{provide: ContentRenderer, useClass: MarkdownContentRendererService},
]
from analog.
@brandonroberts Thank you, the flickering is fixed.
from analog.
Related Issues (20)
- Inconsistent test when running in Nx HOT 1
- Module import only working with relative path, path alias or project root path not working HOT 3
- Analog not working with Create Cloudflare CLI HOT 2
- Including {slugs} in sitemap when using blogtype (SSG) HOT 1
- Event replay js-actions aren't working HOT 2
- TypeError: Cannot read properties of undefined (reading 'minimalContext') HOT 3
- [Bug] An unhandled exception occurred: Workspaces is not a constructor HOT 6
- Unit tests launch with ng test always succeed
- Build fails when using algoliasearch HOT 1
- [FEAT]: Add support for bun:test to angular test integrations HOT 1
- No console logs when testing HOT 5
- HMR doesn't work properly when a `base` property is set in the Vite config
- bug(ssr): API calls return Http failure response HOT 4
- Cannot import angular packages within monorepo setup with workspaces (npm, pnpm)
- Angular services in libraries that depend on services that require a clientProvider work in Astro dev builds but not in production builds HOT 2
- Server API can't import from Nx libs HOT 4
- Gutter icons in VS Code are displayed in the wrong line HOT 1
- Invalid coverage report HOT 1
- attributes and content undefined for .agx files when using `injectContent('slug')` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from analog.