generated from autonomic-cooperative/astro-payload-template
Add alt attribute to imgs
This commit is contained in:
@ -6,11 +6,11 @@ const { content } = Astro.props;
|
||||
const contentArray = getContentArray(content);
|
||||
---
|
||||
|
||||
<div>
|
||||
<article>
|
||||
{
|
||||
contentArray.map((value) => {
|
||||
if (typeof value === "string") {
|
||||
return <article set:html={value} />;
|
||||
return <section set:html={value} />;
|
||||
} else {
|
||||
return (
|
||||
<Image
|
||||
@ -18,10 +18,10 @@ const contentArray = getContentArray(content);
|
||||
width={value.width}
|
||||
height={value.height}
|
||||
format="webp"
|
||||
alt="hallo"
|
||||
alt={value.alt}
|
||||
/>
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</article>
|
||||
|
@ -12,12 +12,13 @@ export const getContentArray = (content: any) => {
|
||||
src: node.value.filename,
|
||||
width: `${node.value.width}`,
|
||||
height: `${node.value.height}`,
|
||||
alt: `${node.value.alt}`,
|
||||
}),
|
||||
},
|
||||
}).replaceAll("<p></p>", "<p> </p>");
|
||||
const htmlImageArray: (
|
||||
| string
|
||||
| { src: string; width: number; height: number }
|
||||
| { src: string; width: number; height: number, alt: string }
|
||||
)[] = [];
|
||||
let lastIndex = 0;
|
||||
while (true) {
|
||||
|
Reference in New Issue
Block a user