diff --git a/README.md b/README.md index 4aa40fef..5dfb358d 100644 --- a/README.md +++ b/README.md @@ -86,24 +86,10 @@ export default defineNuxtConfig({ }) ``` -### Prerender routes +## Guides -While the module is in early access, only pre-rendered routes are supported. +### Create your first og:image -```ts -export default defineNuxtConfig({ - nitro: { - prerender: { - crawlLinks: true, - routes: [ - '/', - // any URLs that can't be discovered by crawler - '/my-hidden-url' - ] - } - } -}) -``` ## Generating Screenshots @@ -250,6 +236,25 @@ the following URLs: - `/your-path/__og-image` Renders the HTML output - `/your-path/og-image.png` Renders the og:image +### Prerender routes + +While the module is in early access, only pre-rendered routes are supported. + +```ts +export default defineNuxtConfig({ + nitro: { + prerender: { + crawlLinks: true, + routes: [ + '/', + // any URLs that can't be discovered by crawler + '/my-hidden-url' + ] + } + } +}) +``` + ## Module Config ### `host` @@ -260,17 +265,6 @@ the following URLs: The host of your site. This is required to generate the absolute path of the og:image. -### `serverSideRender` - -- Type: `boolean` -- Default: `process.dev` - -It allows you to generate images at runtime in production. -This uses a headless browser to generate images -and may have deployment issues. - -⚠️ This is experimental and will likely not work in all environments. - ## Screenshot Options These can be provided as module options to set defaults diff --git a/client/composables/rpc.ts b/client/composables/rpc.ts index b799f1f7..ecf10bd0 100644 --- a/client/composables/rpc.ts +++ b/client/composables/rpc.ts @@ -3,6 +3,8 @@ import { parse, stringify } from 'flatted' import { ref } from 'vue' import type { PlaygroundClientFunctions, PlaygroundServerFunctions } from '../../src/types' +// copied from nuxt/devtools, credits @antfu + const RECONNECT_INTERVAL = 2000 let onMessage: Function = () => {} diff --git a/client/public/nuxt.svg b/client/public/nuxt.svg deleted file mode 100644 index a23ace84..00000000 --- a/client/public/nuxt.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/runtime/composables/defineOgImage.ts b/src/runtime/composables/defineOgImage.ts index 5baa69c3..25b6e7b2 100644 --- a/src/runtime/composables/defineOgImage.ts +++ b/src/runtime/composables/defineOgImage.ts @@ -1,5 +1,6 @@ import { useServerHead } from '@vueuse/head' import { withBase } from 'ufo' +import { useRequestEvent } from '#app' import type { OgImagePayload, OgImageScreenshotPayload } from '../../types' import { useRouter } from '#imports' import { PayloadScriptId } from '#nuxt-og-image/constants' diff --git a/src/runtime/nitro/utils.ts b/src/runtime/nitro/utils.ts index 4f1163b2..77fefbed 100644 --- a/src/runtime/nitro/utils.ts +++ b/src/runtime/nitro/utils.ts @@ -14,7 +14,6 @@ export function renderIsland(island: string, payload: Record) { } export function useHostname(e: H3Event) { - console.log(getRequestHeader(e, 'host'), getRequestHeaders(e)) const host = getRequestHeader(e, 'host') || 'localhost:3000' const protocol = getRequestHeader(e, 'x-forwarded-proto') || 'http' if (protocol.startsWith('http'))