-
+
diff --git a/examples/nuxt-blog-starter/composables/imageProps.js b/examples/nuxt-blog-starter/composables/imageProps.js
index bfcc144..22d49fc 100644
--- a/examples/nuxt-blog-starter/composables/imageProps.js
+++ b/examples/nuxt-blog-starter/composables/imageProps.js
@@ -24,7 +24,7 @@ export default function imageProps(block) {
} else if (block?.download) {
image_url = block.download;
}
- else if (block?.url && block?.image_field) {
+ else if (block?.url && block['@type'] == "image") {
// image block with image_field and url
image_url = block.url;
} else {
@@ -37,6 +37,7 @@ export default function imageProps(block) {
image_url = image_url.startsWith("/") ? `https://hydra-api.pretagov.com${image_url}`: image_url;
//image_url = image.url.replace("https://hydra-api.pretagov.com/", "/plone/"); // nuxt image alias
var srcset = "";
+ var sizes = "";
var width = block?.width;
const field = block?.image_field ? block.image_field : null;
@@ -46,6 +47,10 @@ export default function imageProps(block) {
const scale = block.image_scales[field][0].scales[name];
return `${image_url}/${scale.download} w${scale.width}`;
}).join(", ");
+ sizes = Object.keys(block.image_scales[field][0].scales).map((name) => {
+ const scale = block.image_scales[field][0].scales[name];
+ return `${name}:${scale.width}px`;
+ }).join(" ");
//image_url = image_url + "/@@images/image";
image_url = `${image_url}/${block.image_scales[field][0].download}`;
//width = block.images_scales[field][0].scales[block.styles["size:noprefix"]].width;
@@ -60,6 +65,10 @@ export default function imageProps(block) {
// image block with image_field and url
image_url = `${image_url}/@@images/${block?.image_field}`;
}
+ else if (block['@type'] == "image") {
+ // image block with image_field and url
+ image_url = `${image_url}/@@images/image`;
+ }
else if (!/\.[a-zA-Z]+$/.test(image_url)) {
image_url = "";
}
@@ -71,6 +80,7 @@ export default function imageProps(block) {
size: size,
align: align,
srcset: srcset,
+ sizes: sizes,
bg: `bg-[url('${image_url}')]`,
width: width,
// ...optimizeImage(
diff --git a/examples/nuxt-blog-starter/nuxt.config.ts b/examples/nuxt-blog-starter/nuxt.config.ts
index eba5f05..dc727d8 100644
--- a/examples/nuxt-blog-starter/nuxt.config.ts
+++ b/examples/nuxt-blog-starter/nuxt.config.ts
@@ -73,7 +73,7 @@ export default defineNuxtConfig({
// },
// },
image: {
- provider: 'ipx',
+ //provider: 'ipx',
domains: ['hydra-api.pretagov.com'],
// staticFilename: '[publicPath]/images/[name]-[hash][ext]',
// modifiers: {
diff --git a/examples/nuxt-blog-starter/pages/[...slug].vue b/examples/nuxt-blog-starter/pages/[...slug].vue
index b92f159..a1ddeba 100644
--- a/examples/nuxt-blog-starter/pages/[...slug].vue
+++ b/examples/nuxt-blog-starter/pages/[...slug].vue
@@ -1,6 +1,8 @@
-
+
+
+