Comments (6)
Okay, it works, although the generated URL looks weird.
Thanks, @xiaoxinghu 🙏
from astro-seo.
@millette This only happens on the dev server, if you build/preview it should generate a /_astro/
image
To use a local image you can import it and use it like this:
---
import { SEO } from 'astro-seo'
import cat from '../cat.png'
---
<SEO openGraph={{
basic: {
image: cat,
type: 'type',
title: 'My cat Levi'
}
}}/>
If you are using experimental.assets
image imports are an object so for this example you would use image: cat.src
instead of image: cat
from astro-seo.
this worked for me:
---
import {getImage} from 'astro:assets'
...
const cover = await getImage({ src: imagePath, format:'webp' })
const absCoverUrl = new URL(cover.src, Astro.site)
---
<div>
<SEO
openGraph={{
basic: {
image: absCoverUrl,
},
...
from astro-seo.
@xiaoxinghu Thanks for pitching in here!
@krisnaw Does @xiaoxinghu code fix your problem?
from astro-seo.
How to tackle the same for an SVG?
from astro-seo.
@xiaoxinghu tip #65 (comment) doesn't work with experimental assets, or I last I couldn't make it work. I was expecting to generate an /_astro/an-image.jpg
url but instead got the same url I provided back (/assets/images/an-image.webp
).
from astro-seo.
Related Issues (20)
- Import SEO component doesn't pass astro check HOT 8
- Add advanced Example to readme HOT 4
- Displaying OG info HOT 2
- Add support for Twitter, Open Graph/Facebook HOT 2
- Setting charset within Extend HOT 2
- Get `Cannot find module 'astro-seo' or its corresponding type declarations.ts(2307)` HOT 4
- charset is a bit controversial HOT 2
- Getting strange errors when conditionally loading <SEO /> component. HOT 3
- Please consider providing a way to disable the same title warning HOT 4
- Typo in src/components/ExtendedTags.astro
- how do you make the name logo, i think the astro-seo title logo is nice HOT 1
- localized version of a webpage HOT 5
- 💡 Feature Request: Type extend.link HOT 2
- How can I add Schema / structured data with the help of Astro SEO? HOT 2
- Undesired escaping of characters HOT 2
- The media attribute is ignored when included in extend.meta HOT 2
- Setting Astro trailingSlash to never still sets canonical url to url with a 'trailing slash' HOT 8
- Add support for latest version of Astro HOT 1
- Security
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro-seo.