nuxt-og-image 1.0.0-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -86,24 +86,10 @@ export default defineNuxtConfig({
|
|
|
86
86
|
})
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
## Guides
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
### Create your first og:image
|
|
92
92
|
|
|
93
|
-
```ts
|
|
94
|
-
export default defineNuxtConfig({
|
|
95
|
-
nitro: {
|
|
96
|
-
prerender: {
|
|
97
|
-
crawlLinks: true,
|
|
98
|
-
routes: [
|
|
99
|
-
'/',
|
|
100
|
-
// any URLs that can't be discovered by crawler
|
|
101
|
-
'/my-hidden-url'
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
```
|
|
107
93
|
|
|
108
94
|
## Generating Screenshots
|
|
109
95
|
|
|
@@ -250,6 +236,25 @@ the following URLs:
|
|
|
250
236
|
- `/your-path/__og-image` Renders the HTML output
|
|
251
237
|
- `/your-path/og-image.png` Renders the og:image
|
|
252
238
|
|
|
239
|
+
### Prerender routes
|
|
240
|
+
|
|
241
|
+
While the module is in early access, only pre-rendered routes are supported.
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
export default defineNuxtConfig({
|
|
245
|
+
nitro: {
|
|
246
|
+
prerender: {
|
|
247
|
+
crawlLinks: true,
|
|
248
|
+
routes: [
|
|
249
|
+
'/',
|
|
250
|
+
// any URLs that can't be discovered by crawler
|
|
251
|
+
'/my-hidden-url'
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
```
|
|
257
|
+
|
|
253
258
|
## Module Config
|
|
254
259
|
|
|
255
260
|
### `host`
|
|
@@ -260,17 +265,6 @@ the following URLs:
|
|
|
260
265
|
|
|
261
266
|
The host of your site. This is required to generate the absolute path of the og:image.
|
|
262
267
|
|
|
263
|
-
### `serverSideRender`
|
|
264
|
-
|
|
265
|
-
- Type: `boolean`
|
|
266
|
-
- Default: `process.dev`
|
|
267
|
-
|
|
268
|
-
It allows you to generate images at runtime in production.
|
|
269
|
-
This uses a headless browser to generate images
|
|
270
|
-
and may have deployment issues.
|
|
271
|
-
|
|
272
|
-
⚠️ This is experimental and will likely not work in all environments.
|
|
273
|
-
|
|
274
268
|
## Screenshot Options
|
|
275
269
|
|
|
276
270
|
These can be provided as module options to set defaults
|
package/dist/module.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useServerHead } from "@vueuse/head";
|
|
2
2
|
import { withBase } from "ufo";
|
|
3
|
+
import { useRequestEvent } from "#app";
|
|
3
4
|
import { useRouter } from "#imports";
|
|
4
5
|
import { PayloadScriptId } from "#nuxt-og-image/constants";
|
|
5
6
|
import { forcePrerender, height, host, width } from "#nuxt-og-image/config";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { joinURL, withQuery } from "ufo";
|
|
2
|
-
import { getRequestHeader
|
|
2
|
+
import { getRequestHeader } from "h3";
|
|
3
3
|
export function fetchPayload(path) {
|
|
4
4
|
return $fetch(joinURL(path, "__og_image__/payload"));
|
|
5
5
|
}
|
|
@@ -9,7 +9,6 @@ export function renderIsland(island, payload) {
|
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
11
11
|
export function useHostname(e) {
|
|
12
|
-
console.log(getRequestHeader(e, "host"), getRequestHeaders(e));
|
|
13
12
|
const host = getRequestHeader(e, "host") || "localhost:3000";
|
|
14
13
|
const protocol = getRequestHeader(e, "x-forwarded-proto") || "http";
|
|
15
14
|
if (protocol.startsWith("http"))
|
package/package.json
CHANGED
package/dist/client/nuxt.svg
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="324" height="324" viewBox="0 0 324 324" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M181.767 270H302.211C306.037 270 309.795 269.003 313.108 267.107C316.421 265.211 319.172 262.484 321.084 259.2C322.996 255.915 324.002 252.19 324 248.399C323.998 244.607 322.989 240.883 321.074 237.601L240.187 98.7439C238.275 95.4607 235.525 92.7342 232.213 90.8385C228.901 88.9429 225.143 87.9449 221.318 87.9449C217.494 87.9449 213.736 88.9429 210.424 90.8385C207.112 92.7342 204.361 95.4607 202.449 98.7439L181.767 134.272L141.329 64.7975C139.416 61.5145 136.664 58.7884 133.351 56.8931C130.038 54.9978 126.28 54 122.454 54C118.629 54 114.871 54.9978 111.558 56.8931C108.245 58.7884 105.493 61.5145 103.58 64.7975L2.92554 237.601C1.01067 240.883 0.00166657 244.607 2.06272e-06 248.399C-0.00166244 252.19 1.00407 255.915 2.91605 259.2C4.82803 262.484 7.57884 265.211 10.8918 267.107C14.2047 269.003 17.963 270 21.7886 270H97.3936C127.349 270 149.44 256.959 164.641 231.517L201.546 168.172L221.313 134.272L280.637 236.1H201.546L181.767 270ZM96.1611 236.065L43.3984 236.054L122.49 100.291L161.953 168.172L135.531 213.543C125.436 230.051 113.968 236.065 96.1611 236.065Z" fill="#00DC82"/>
|
|
3
|
-
</svg>
|