nuxt-og-image 3.0.0-rc.58 → 3.0.0-rc.59

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.
@@ -263,4 +263,4 @@
263
263
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.BvA2Ms0H.css">
264
264
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/BcPNQIyk.js">
265
265
  <script type="module" src="/__nuxt-og-image/_nuxt/JbSdNPJo.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
266
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"3c2eb264-e26b-4b2c-954a-048093a4a53a",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
266
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"0068a7ad-6631-4ed0-8f58-d22eb18a82d5",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -263,4 +263,4 @@
263
263
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.BvA2Ms0H.css">
264
264
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/BcPNQIyk.js">
265
265
  <script type="module" src="/__nuxt-og-image/_nuxt/JbSdNPJo.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
266
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"3c2eb264-e26b-4b2c-954a-048093a4a53a",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
266
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"0068a7ad-6631-4ed0-8f58-d22eb18a82d5",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"3c2eb264-e26b-4b2c-954a-048093a4a53a","timestamp":1720689350152}
1
+ {"id":"0068a7ad-6631-4ed0-8f58-d22eb18a82d5","timestamp":1720692413225}
@@ -0,0 +1 @@
1
+ {"id":"0068a7ad-6631-4ed0-8f58-d22eb18a82d5","timestamp":1720692413225,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -263,4 +263,4 @@
263
263
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.BvA2Ms0H.css">
264
264
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/BcPNQIyk.js">
265
265
  <script type="module" src="/__nuxt-og-image/_nuxt/JbSdNPJo.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
266
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"3c2eb264-e26b-4b2c-954a-048093a4a53a",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
266
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"0068a7ad-6631-4ed0-8f58-d22eb18a82d5",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "3.0.0-rc.57",
8
+ "version": "3.0.0-rc.58",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.1",
11
11
  "unbuild": "2.0.0"
@@ -108,7 +108,7 @@ export function extractAndNormaliseOgImageOptions(html) {
108
108
  const htmlPayload = html.match(/<script.+id="nuxt-og-image-options"[^>]*>(.+?)<\/script>/)?.[1];
109
109
  if (!htmlPayload)
110
110
  return false;
111
- let options;
111
+ let options = false;
112
112
  try {
113
113
  const payload2 = JSON.parse(htmlPayload);
114
114
  Object.entries(payload2).forEach(([key, value]) => {
@@ -122,11 +122,13 @@ export function extractAndNormaliseOgImageOptions(html) {
122
122
  }
123
123
  if (!options)
124
124
  return false;
125
- const description = html.match(/<meta[^>]+name="description"[^>]*>/)?.[0];
126
- if (description) {
127
- const [, content] = description.match(/content="([^"]+)"/) || [];
128
- if (content && !options.props.description)
129
- options.props.description = content;
125
+ if (typeof options.props?.description === "undefined") {
126
+ const description = html.match(/<meta[^>]+name="description"[^>]*>/)?.[0];
127
+ if (description) {
128
+ const [, content] = description.match(/content="([^"]+)"/) || [];
129
+ if (content && !options.props.description)
130
+ options.props.description = content;
131
+ }
130
132
  }
131
133
  const payload = decodeObjectHtmlEntities(options);
132
134
  if (import.meta.dev) {
@@ -11,7 +11,8 @@ const props = withDefaults(defineProps<{ title?: string, description?: string, h
11
11
  headline: 'headline',
12
12
  })
13
13
 
14
- const title = computed(() => props.title.slice(0, 60))
14
+ const title = computed(() => (props.title || '').slice(0, 60))
15
+ const description = computed(() => (props.description || '').slice(0, 200))
15
16
  </script>
16
17
 
17
18
  <template>
@@ -48,11 +49,11 @@ const title = computed(() => props.title.slice(0, 60))
48
49
  <p v-if="headline" class="uppercase text-[24px] text-[#00DC82] mb-4 font-semibold">
49
50
  {{ headline }}
50
51
  </p>
51
- <h1 class="w-[600px] m-0 text-[75px] font-semibold mb-4 text-white flex items-center">
52
+ <h1 v-if="title" class="w-[600px] m-0 text-[75px] font-semibold mb-4 text-white flex items-center">
52
53
  <span>{{ title }}</span>
53
54
  </h1>
54
- <p class="text-[32px] text-[#E4E4E7] leading-tight">
55
- {{ description.slice(0, 200) }}
55
+ <p v-if="description" class="text-[32px] text-[#E4E4E7] leading-tight">
56
+ {{ description }}
56
57
  </p>
57
58
  </div>
58
59
  <svg
@@ -41,7 +41,7 @@ export function createOgImageMeta(src, input, resolvedOptions, ssrContext) {
41
41
  type: "application/json",
42
42
  processTemplateParams: true,
43
43
  innerHTML: () => {
44
- if (!_input.props.title)
44
+ if (typeof _input.props.title === "undefined")
45
45
  _input.props.title = "%s";
46
46
  delete _input.url;
47
47
  return _input;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "3.0.0-rc.58",
4
+ "version": "3.0.0-rc.59",
5
5
  "description": "Enlightened OG Image generation for Nuxt.",
6
6
  "author": {
7
7
  "website": "https://harlanzw.com",
@@ -1 +0,0 @@
1
- {"id":"3c2eb264-e26b-4b2c-954a-048093a4a53a","timestamp":1720689350152,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}