Embedding videos #116
-
| Is there any way of embedding a youtube or vimeo video in the markdown files? |
Beta Was this translation helpful? Give feedback.
Answered by timlrx Jul 15, 2021
Replies: 3 comments 25 replies
-
| you can just copy and paste the youtube iframe code directly to the mdx file. |
Beta Was this translation helpful? Give feedback.
24 replies
Answer selected by salmanhk
-
| Hello Timothy! Nice to hear from you. And thank you so much for making the code available. I am planning to use it to build a band site with data/music, data/blog and data/memberbio to replace my old and buggy Drupal 7 site. This feels like an impossible task as I am new to github, nextjs, tailwind, etc. But I love the idea of having my blog and songs stored in mdx with nestable paths. Your code on GitHub gave me a place to start. My next challenge is to modify the code to fit my directory structure. Do you mind pointing out the files to modify? Thank you so so much! Wendy …On Sun, Nov 14, 2021 at 3:10 AM Timothy ***@***.***> wrote: In this case, you should standardize a frontmatter field e.g. youtube across all your markdown documents. This will contain the youtube URL link. Since all frontmatter information is passed to the layout, you can extract it over there: https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/master/layouts/PostLayout.js#L20 const { slug, fileName, date, title, tags, youtube } = frontMatter and render the video as desired. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#116 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AWISIMQQJTUXKNYS2BIL4LLUL6KKNANCNFSM5AMMTVSQ> . Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>. |
Beta Was this translation helpful? Give feedback.
1 reply
-
| Great. I will follow your instructions to give it a try. How should I modify components/Pagination.js as it contains "/blog/" Thanks, Wendy …On Sun, Nov 14, 2021 at 8:39 PM Timothy ***@***.***> wrote: Hi Wendy, yes it will be quite challenging if you are new to react / nextjs. You probably won't want to store the music and songs with the website, but use a file sharing service like youtube. Each mdx file in data/music can then contain a frontmatter link to the song as described above. As to the files to modify, for each folder / section you include in data, you probably want a page for it. You can copy the pages/blog example and modify it so you get a page/music. You will then need to modify them to source the content from the right folder, by modifying blog to the appropriate folder name e.g. https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/master/pages/blog/%5B...slug%5D.js#L10 You would probably want to customize and use a different template for each page type. You can add a new layout to the layouts folder and modify the DEFAULT_LAYOUT field over here <https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/master/pages/blog/%5B...slug%5D.js#L7> — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#116 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AWISIMVIEUC4O3ZTHOUBFFTUMCFJTANCNFSM5AMMTVSQ> . Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment




you can just copy and paste the youtube iframe code directly to the mdx file.