Using variables
shinokada opened this issue · comments
I'm using mdsvex and my markdown pages have variables:
---
layout: componentLayout
title: My Title
breadcrumb_title: My-breadcrumb
dir: Components
description: 'My description'
---
I can use them for some cases:
<MetaTags
title={breadcrumb_title}
titleTemplate="%s | Flowbite-Svelte"
description={description}
...
But not in {{}}
:
openGraph={{
...
title: {title}, // this won't work
description: {title},// this won't work
images: [
{
...
alt: {title} // this won't work
}
],
site_name: 'Flowbite-Svelte'
}}
twitter={{
...
title: {title},// this won't work
description: {description},// this won't work
...
}}
How can I use variables in {{}}
?
Ok, I just needed to use a back tick:
openGraph={{
title: `${title}`,
description: `${title}`,
images: [
{
url: `https://example.com?title=${breadcrumb_title}`,
width: 800,
height: 600,
alt: `${title}`
}
],
...
}}