summaryrefslogtreecommitdiff
path: root/examples/blog/src/pages/index.astro
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blog/src/pages/index.astro')
-rw-r--r--examples/blog/src/pages/index.astro10
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} />