Comments (6)
How are you rendering your MDX content?
As a general answer, YouTube embeds require JavaScript, which isn’t supported in RSS feeds. I think the closest result you could get would be to render an image which links to YouTube, but I’d need to know more about your set-up to advise further.
from astro-embed.
Thanks for getting back.
This is my rss.xml.js:
import rss from '@astrojs/rss'
import MarkdownIt from 'markdown-it'
const parser = new MarkdownIt()
import { getCollection } from 'astro:content'
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'
export async function get(context) {
const posts = await getCollection('posts')
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/posts/${post.slug}/`,
content: parser.render(post.body),
})),
})
}
I’ve seen feeds which have YouTube embeds and I can watch them directly in my RSS reader.
from astro-embed.
Ah, ok, so in this case you'd need a way to tell markdown-it how to render the embed.
But first, you'd need to work out what it should generate. Can you share an example RSS feed with an embedded video to see what markup it includes?
from astro-embed.
I think this is what we’re looking for:
Source: https://css-irl.info/rss.xml (search for iframe
)
from astro-embed.
OK, so that’s the standard YouTube <iframe>
code. That should be possible to generate, but your parser.render()
method would need to know how to do that, i.e. find <YouTube id="xtTy5nKay_Y" />
and convert it to:
<iframe width="560" height="315" src="https://www.youtube.com/embed/xtTy5nKay_Y" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
As far as I can tell that’s a simple mapping of the id
to the last part of the URL in src
attribute of the <iframe>
. I’m not familiar with how markdown-it
plugins work, so not sure exactly you’d do the transformation.
from astro-embed.
Closing this issue as out of scope for this repository. Thanks again for opening @johannesholmberg!
from astro-embed.
Related Issues (20)
- Fix: Astro v4 compatibility HOT 3
- Querstion: How can I overview the max-width CSS rule on lite-youtube element?
- Random CLS in Firefox when playing the video HOT 2
- FR: Support Bandcamp embeds
- Issue: Autoplay not working in param HOT 1
- The requested module '/node_modules/cssesc/cssesc.js?v=4e7cd4a1' does not provide an export named 'default'
- Build fails: Rollup failed to resolve import "linkedom" HOT 4
- @astro-community/astro-embed-vimeo package doesn't list the dependency of @astro-community/astro-embed-utils HOT 1
- Lighthouse: Links are not crawlable with `<YouTube>` HOT 9
- Regression in link embedding since 0.7.0 HOT 2
- Youtube embed isn't filling it's container like before when played. HOT 1
- Build not working with SSR adapter HOT 4
- Vimeo web component is not being defined HOT 3
- tiktok embed HOT 1
- Feature Request: disable images via a prop HOT 1
- MDX integration imports all providers HOT 1
- Invalid video ID raises exception with Vimeo provider HOT 1
- Tweet component is broken HOT 1
- Enhance embed with GDPR-compliant user consent mechanism
- Astro Image Asset Not Used HOT 2
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-embed.