diff --git a/examples/blog/README.md b/examples/blog/README.md index c5a53616b..b351bee6e 100644 --- a/examples/blog/README.md +++ b/examples/blog/README.md @@ -10,12 +10,12 @@ npm init astro -- --template blog Features: -- ✅ SEO-friendly setup with canonical URLs and OpenGraph data -- ✅ `@astrojs/image` image optimizations -- ✅ Sitemap support -- ✅ Markdown & MDX support - ✅ Minimal styling (make it your own!) - ✅ 100/100 Lighthouse performance +- ✅ SEO-friendly with canonical URLs and OpenGraph data +- ✅ Sitemap support +- ✅ RSS Feed support +- ✅ Markdown & MDX support ## 🚀 Project Structure diff --git a/examples/blog/astro.config.mjs b/examples/blog/astro.config.mjs index 42d5390f5..56ceef4da 100644 --- a/examples/blog/astro.config.mjs +++ b/examples/blog/astro.config.mjs @@ -1,10 +1,10 @@ import { defineConfig } from 'astro/config'; -import image from '@astrojs/image'; import mdx from '@astrojs/mdx'; import sitemap from '@astrojs/sitemap'; // https://astro.build/config export default defineConfig({ - integrations: [image(), mdx(), sitemap()], + site: 'https://example.com', + integrations: [ mdx(), sitemap()], }); diff --git a/examples/blog/package.json b/examples/blog/package.json index f214c8eee..d6a6f206c 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "devDependencies": { - "@astrojs/image": "^0.3.3", "@astrojs/mdx": "^0.9.0", + "@astrojs/rss": "^1.0.0", "@astrojs/sitemap": "^1.0.0", "astro": "^1.0.5" } diff --git a/examples/blog/public/placeholder-about.jpg b/examples/blog/public/placeholder-about.jpg new file mode 100644 index 000000000..2f736d92a Binary files /dev/null and b/examples/blog/public/placeholder-about.jpg differ diff --git a/examples/blog/public/placeholder-hero.jpg b/examples/blog/public/placeholder-hero.jpg new file mode 100644 index 000000000..66c86497e Binary files /dev/null and b/examples/blog/public/placeholder-hero.jpg differ diff --git a/examples/blog/public/placeholder-social.jpg b/examples/blog/public/placeholder-social.jpg index 186a66eb4..e8844fed3 100644 Binary files a/examples/blog/public/placeholder-social.jpg and b/examples/blog/public/placeholder-social.jpg differ diff --git a/examples/blog/src/assets/placeholder-about.jpg b/examples/blog/src/assets/placeholder-about.jpg deleted file mode 100644 index 9653cc1c5..000000000 Binary files a/examples/blog/src/assets/placeholder-about.jpg and /dev/null differ diff --git a/examples/blog/src/assets/placeholder-hero.jpg b/examples/blog/src/assets/placeholder-hero.jpg deleted file mode 100644 index c8898768d..000000000 Binary files a/examples/blog/src/assets/placeholder-hero.jpg and /dev/null differ diff --git a/examples/blog/src/layouts/BlogPost.astro b/examples/blog/src/layouts/BlogPost.astro index 7587913f7..177fe2519 100644 --- a/examples/blog/src/layouts/BlogPost.astro +++ b/examples/blog/src/layouts/BlogPost.astro @@ -2,36 +2,20 @@ import BaseHead from "../components/BaseHead.astro"; import Header from "../components/Header.astro"; import Footer from "../components/Footer.astro"; -import {Image} from '@astrojs/image/components'; export interface Props { content: { title: string; description: string; - publishDate?: string; + pubDate?: string; updatedDate?: string; heroImage?: string; }; } const { - content: { title, description, publishDate, updatedDate, heroImage }, + content: { title, description, pubDate, updatedDate, heroImage }, } = Astro.props as Props; - - -// Match the `heroImage` frontmatter string to its correct -// Astro.glob() import of the file in the src/ directory. -const assets = await Astro.glob('../assets/**/*'); -const heroImageAsset = assets.find(asset => { - if (!heroImage) { - return false; - } - if (!asset.default?.src) { - return false; - } - const index = asset.default.src.indexOf('/assets/'); - return asset.default.src.slice(index) === heroImage; -}); --- @@ -53,16 +37,16 @@ const heroImageAsset = assets.find(asset => {
- {heroImageAsset && ( - )}

{title}

- {publishDate && } + {pubDate && } {updatedDate &&
Last updated on
}
diff --git a/examples/blog/src/pages/about.md b/examples/blog/src/pages/about.md index ee0b25ca4..2aeb6562e 100644 --- a/examples/blog/src/pages/about.md +++ b/examples/blog/src/pages/about.md @@ -3,7 +3,7 @@ layout: "../layouts/BlogPost.astro" title: "About Me" description: "Lorem ipsum dolor sit amet" updatedDate: "August 08 2022" -heroImage: "/assets/placeholder-about.jpg" +heroImage: "/placeholder-about.jpg" --- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Adipiscing enim eu turpis egestas pretium. Euismod elementum nisi quis eleifend quam adipiscing. In hac habitasse platea dictumst vestibulum. Sagittis purus sit amet volutpat. Netus et malesuada fames ac turpis egestas. Eget magna fermentum iaculis eu non diam phasellus vestibulum lorem. Varius sit amet mattis vulputate enim. Habitasse platea dictumst quisque sagittis. Integer quis auctor elit sed vulputate mi. Dictumst quisque sagittis purus sit amet. diff --git a/examples/blog/src/pages/blog.astro b/examples/blog/src/pages/blog.astro index 1ba45a36c..73576c498 100644 --- a/examples/blog/src/pages/blog.astro +++ b/examples/blog/src/pages/blog.astro @@ -7,7 +7,7 @@ import { SITE_TITLE, SITE_DESCRIPTION } from '../config'; // Use Astro.glob() to fetch all posts, and then sort them by date. const posts = (await Astro.glob('./blog/*.{md,mdx}')).sort( (a, b) => - new Date(b.frontmatter.publishDate).valueOf() - new Date(a.frontmatter.publishDate).valueOf() + new Date(b.frontmatter.pubDate).valueOf() - new Date(a.frontmatter.pubDate).valueOf() ); --- @@ -40,8 +40,8 @@ const posts = (await Astro.glob('./blog/*.{md,mdx}')).sort(
    {posts.map((post) => (
  • -