Skip to content

Commit

Permalink
progress commit
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 19, 2023
1 parent 3ec13e8 commit 1013e26
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 31 deletions.
48 changes: 21 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions client/composables/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {}

Expand Down
3 changes: 0 additions & 3 deletions client/public/nuxt.svg

This file was deleted.

1 change: 1 addition & 0 deletions src/runtime/composables/defineOgImage.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
1 change: 0 additions & 1 deletion src/runtime/nitro/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export function renderIsland(island: string, payload: Record<string, any>) {
}

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'))
Expand Down

0 comments on commit 1013e26

Please sign in to comment.