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/src | |
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/src')
-rw-r--r-- | examples/blog/src/pages/index.astro | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/blog/src/pages/index.astro b/examples/blog/src/pages/index.astro index c61340fdd..2f0cdb01c 100644 --- a/examples/blog/src/pages/index.astro +++ b/examples/blog/src/pages/index.astro @@ -1,16 +1,24 @@ --- +// Component Imports import BaseHead from '../components/BaseHead.astro'; import BlogHeader from '../components/BlogHeader.astro'; import BlogPostPreview from '../components/BlogPostPreview.astro'; +// 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 = 'Example Blog'; let description = 'The perfect starter for your perfect blog.'; let permalink = 'https://example.com/'; +// Data Fetching: List all Markdown posts in the repo. let allPosts = Astro.fetchContent('./posts/*.md'); allPosts = allPosts.sort((a, b) => new Date(b.date) - new Date(a.date)); ---- +// Full Astro Component Syntax: +// https://github.com/snowpackjs/astro/blob/main/docs/core-concepts/astro-components.md +--- <html> <head> <BaseHead title={title} description={description} permalink={permalink} /> |