Routing
wskazówka
W Astro mamy file-based routing, to znaczy, że nie mamy osobnego routera, a nasze pliki w folderze pages
są serwowane jako podstrony. Nazwy plików determinują, jaki będzie adres strony.
Dozwolone formaty stron:
.astro
- format zewnętrznego framework'u np.
.jsx
lub.tsx
z React,.vue
, itp... .md
- markdown.mdx
- markdown z możliwością importu komponentów
Dodajmy podstronę "Kontakt"
- Nowy plik
src/pages/contact.astro
---
import { Image } from "astro:assets";
import Layout from "../layouts/Layout.astro";
---
<Layout title="Contact Page">
<h1>Contact</h1>
<hr />
<div class="row">
<div class="col min-vh-100">
<h2>Chocolate Cake Inc.</h2>
<p>
Street 3 Central St <br />
City/Town Farmington <br />
State/Province/Region New Jersey <br />
Zip/Postal Code 03835 <br />
USA
<br />
Phone Number
<a href="tel:6037559409">(603) 755-9409</a>
</p>
</div>
<div class="col">
<Image
class="img-fluid mb-3 rounded"
height={100}
width={1024}
src="https://images.pexels.com/photos/291528/pexels-photo-291528.jpeg"
alt="chocolate cake"
/>
</div>
</div>
</Layout>
Dodajmy podstronę "O mnie" z wykorzystaniem Markdown
Nowy plik src/pages/about.md
---
layout: '../layouts/Layout.astro'
title: 'About me'
---
# About Me: Software Development and Chocolate Cake Enthusiast
---
Welcome to my world of decadent delight and sweet indulgence! I'm [Your Name], and I am absolutely passionate about chocolate cakes.
## A Love That Started Early
My love affair with chocolate cakes began at a tender age. I vividly remember my grandmother's kitchen filled with the aroma of freshly baked chocolate cakes, and the first bite of that moist, rich cake was a revelation. From that moment, I knew I was destined to become a chocolate cake enthusiast.
## Baking Adventures
Over the years, I've honed my baking skills to create the perfect chocolate cake. I've experimented with countless recipes, tweaked ingredients, and perfected the art of achieving the ideal balance of fudginess and sweetness. My kitchen is my laboratory, and every cake I bake is an experiment in taste and texture. I love to share my creations with friends and family, and I'm always seeking new ways to innovate with chocolate cake recipes.
## A Chocolate Cake Advocate
Beyond baking and sharing, I'm an advocate for all things chocolate cake. I firmly believe that there's a chocolate cake for every occasion, from birthdays to simple Tuesday evenings when you just need a little pick-me-up. I'm always on the hunt for the best chocolate cake in town, and I love exploring bakeries, cafes, and patisseries to discover hidden gems.
Join Me in My Chocolate Cake Journey!