Giter Club home page Giter Club logo

Comments (4)

tomaskebrle avatar tomaskebrle commented on September 25, 2024 1

Should hopefully work now. But you need to install the beta version npm i [email protected]

from astro-og-image.

tomaskebrle avatar tomaskebrle commented on September 25, 2024

Yeah I am not sure if this is currently possible, altough if you use some kind of layout, i think it could work. I can try to make it work if you would provide a code example on how you have your site setup since I have never worked with storyblok. Also I'm currently quite busy with school, so I can maybe take a look on thursday.

from astro-og-image.

preetamslot avatar preetamslot commented on September 25, 2024

Take your time, no hurry :)
Here is the documentation on storyblok:
https://github.com/storyblok/storyblok-astro
it just uses the getStaticPaths to create all routes.

It would be great if we could use the og image as a component. so we can pass all data and images and style it.

Thanks again!

from astro-og-image.

tomaskebrle avatar tomaskebrle commented on September 25, 2024

https://stackblitz.com/edit/astro-sdk-demo-txt2qd?file=src/layouts/BaseLayout.astro
Just by looking at it, this should make it work however, I was not able to confirm it works

But you just need to pass the slug back to BaseLayout

<!-- [slug].astro -->
<BaseLayout slug={slug}>

add meta tags to the head

<!-- BaseLayout.astro -->
<meta
  property="og:image"
  content={slug !== undefined
    ? `/assets/${slug}.png`
    : `/assets/fallback-image.png`}
/>
<meta
  property="twitter:image"
  content={slug !== undefined
    ? `/assets/${slug}.png`
    : `/assets/fallback-image.png`}
/>

and change the astro.config.mjs

astroOGImage({
  config: {
    path: "/pages",
  },
}),

from astro-og-image.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.