diff options
author | 2021-07-01 05:43:02 -0700 | |
---|---|---|
committer | 2021-07-01 08:43:02 -0400 | |
commit | 8f74b3bdbb1cae31e036daf1b7f5fc28686ddd4d (patch) | |
tree | ef46c13328abae62209ad30d49401285f5f72a01 /examples/blog-multiple-authors/src/pages/index.astro | |
parent | 6a660f1b08430fe6e8f0e0939220511827cb0bc0 (diff) | |
download | astro-8f74b3bdbb1cae31e036daf1b7f5fc28686ddd4d.tar.gz astro-8f74b3bdbb1cae31e036daf1b7f5fc28686ddd4d.tar.zst astro-8f74b3bdbb1cae31e036daf1b7f5fc28686ddd4d.zip |
update example astro inline docs (#592)
Diffstat (limited to 'examples/blog-multiple-authors/src/pages/index.astro')
-rw-r--r-- | examples/blog-multiple-authors/src/pages/index.astro | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/examples/blog-multiple-authors/src/pages/index.astro b/examples/blog-multiple-authors/src/pages/index.astro index a4407378c..adcf04215 100644 --- a/examples/blog-multiple-authors/src/pages/index.astro +++ b/examples/blog-multiple-authors/src/pages/index.astro @@ -1,23 +1,25 @@ --- +// Component Imports import MainHead from '../components/MainHead.astro'; import Nav from '../components/Nav.astro'; import PostPreview from '../components/PostPreview.astro'; import Pagination from '../components/Pagination.astro'; +import authorData from '../data/authors.json'; -// page +// Component Script: +// You can write any JavaScript/TypeScript that you'd like here. +// It will run during the build, but never in the browser. +// All variables are available to use in the HTML template below. let title = 'Don’s Blog'; let description = 'An example blog on Astro'; -// collection -// note: we want to show first 3 posts here, but we don’t want to paginate at /1, /2, /3, etc. -// so we show a preview of posts here, but actually paginate from $posts.astro -import authorData from '../data/authors.json'; - +// Data Fetching: List all Markdown posts in the repo. let allPosts = Astro.fetchContent('./post/*.md'); allPosts.sort((a, b) => new Date(b.date) - new Date(a.date)); -let firstPage = allPosts.slice(0, 2); ---- +// Full Astro Component Syntax: +// https://github.com/snowpackjs/astro/blob/main/docs/core-concepts/astro-components.md +--- <html> <head> <title>{title}</title> |