Comments (3)
Does your HCMS have a running Nuxt server currently?
from nuxt.
We have our nuxt project/code included in the HCMS and call it like programmatically like this:
(We also mock the nuxt/content module with a custom content wrapper to inject the to be previewed page-draft content into the inmemory lokidb (for that we will also need to find a replacement solution)
module.exports.renderPage = async (draftContent, livingdocsApis) => {
let contentApi
const projectId = draftContent.systemdata.projectId
const { language, slug } = draftContent.metadata
const route = `/${language.locale}/${slug}`
const config = await loadNuxtConfig({
rootDir: path.join(__dirname, '../'),
for: 'start'
})
config.dev = false
config._start = true
config.router = { mode: 'hash' }
config.modules = config.modules.filter(module => module !== '@nuxt/content')
config.modules.push('~/modules/content/async.js')
config.hooks = {
content: {
api (hook) {
contentApi = hook
}
}
}
config.build.publicPath = '/proxy/api/_nuxt/'
const nuxt = new Nuxt(config)
await nuxt.ready() // it initialize `hooks` & `modules` from the `config` object
contentApi.overrideLivingdocsService(projectId, livingdocsApis)
await contentApi.insert(draftContent)
const renderedRoute = await nuxt.renderRoute(route)
await nuxt.close()
return renderedRoute
}
Then we can get the generated HTML :
const {html, error} = await ssg.renderPage(doc, livingdocsApi)
from nuxt.
Any idea/updates/hint?
from nuxt.
Related Issues (20)
- The websocket service in the middleware is unable to send messages to the client. HOT 2
- Remove or fix `state` from islands components HOT 1
- Body style background image does not update when theme changes HOT 11
- Cannot navigate from one page Alias to another HOT 6
- I can't use useRuntimeConfig in async setup function (Options API) HOT 3
- WARN Cannot stringify arbitrary non-POJOs Error HOT 5
- Fine-grained config of the SSR renderer's Nitro event handler via hook
- 📚Docs: Gitlab Pages deployment guide HOT 1
- Failed to resolve component: datetime If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. at <Router> HOT 2
- nuxt3.11.1 build usefetch cannot get local data HOT 1
- Issue with Vite Plugin in Windows OS HOT 2
- RangeError: Maximum call stack size exceeded HOT 10
- In a production environment, it is not possible to modify files in the public directory. HOT 1
- Allow dedicated error pages for child routes HOT 2
- Nuxt super slow load time when running dev localhost in newer versions. HOT 2
- False positive warning about calling `useRoute` within middleware HOT 3
- option to set Layout in routeRules HOT 2
- useRoute is considered as any by typescript-eslint with unplugin-vue-router HOT 2
- How to copy file to folder .output after build HOT 1
- FetchError type HOT 4
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 nuxt.