nuxt-og-image 2.0.6 → 2.0.8

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.
@@ -11,7 +11,7 @@ function decodeObjectHtmlEntities(obj) {
11
11
  });
12
12
  return obj;
13
13
  }
14
- export function extractOgImageOptions(html, routeRules) {
14
+ export function extractAndNormaliseOgImageOptions(path, html, routeRules, defaults) {
15
15
  const htmlPayload = html.match(/<script id="nuxt-og-image-options" type="application\/json">(.+?)<\/script>/)?.[1];
16
16
  if (!htmlPayload)
17
17
  return false;
@@ -28,15 +28,20 @@ export function extractOgImageOptions(html, routeRules) {
28
28
  if (process.dev)
29
29
  console.warn("Failed to parse #nuxt-og-image-options", e, options);
30
30
  }
31
- if (options) {
32
- if (!options.description) {
33
- const description = html.match(/<meta property="og:description" content="(.*?)">/)?.[1];
34
- if (description)
35
- options.description = description;
36
- else
37
- options.description = html.match(/<meta name="description" content="(.*?)">/)?.[1];
38
- }
39
- return decodeObjectHtmlEntities(options);
31
+ if (!options)
32
+ return false;
33
+ if (!options.description) {
34
+ const description = html.match(/<meta property="og:description" content="(.*?)">/)?.[1];
35
+ if (description)
36
+ options.description = description;
37
+ else
38
+ options.description = html.match(/<meta name="description" content="(.*?)">/)?.[1];
40
39
  }
41
- return false;
40
+ const decoded = decodeObjectHtmlEntities(options);
41
+ return defu(
42
+ decoded,
43
+ // runtime options
44
+ { path },
45
+ defaults
46
+ );
42
47
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "2.0.6",
5
- "packageManager": "pnpm@8.6.6",
4
+ "version": "2.0.8",
5
+ "packageManager": "pnpm@8.6.7",
6
6
  "description": "Enlightened OG Image generation for Nuxt.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",