Overview
Astro Portfolio v3 includes two main layout components that provide consistent structure and SEO optimization across your site. Layouts wrap your page content with common elements like navigation, footer, and metadata.Available Layouts
- Layout.astro
- BlogLayout.astro
The base layout used for all standard pages including the homepage, about page, and other static pages.Location:
src/layouts/Layout.astroFeatures
- Complete SEO metadata (Open Graph, Twitter Cards, JSON-LD)
- Favicon and manifest configuration
- Theme initialization
- Google Tag Manager integration
- Astro view transitions
- Persistent footer and social links
Base Layout (Layout.astro)
Props Interface
Props Reference
string
The page title shown in browser tabs and search results
string
default:"siteConfig.description"
Meta description for SEO
string
default:"siteConfig.title"
Open Graph title for social media sharing
string
Open Graph description for social media previews
string
default:"'/opengraph.png'"
Social media preview image URL
string
default:"'Lewis Kori'"
Content author name
string
ISO 8601 timestamp for article publication date
'website' | 'article'
default:"'website'"
Open Graph content type
string
default:"Astro.url"
Canonical URL for the page
Usage Example
src/pages/about.astro
Layout Structure
src/layouts/Layout.astro
Blog Layout (BlogLayout.astro)
Props Interface
Props Reference
string
required
The blog post title
string
required
Blog post description/excerpt
string
required
Author name
Date
required
Publication date as a Date object
string[]
Array of tags for the post
string
Cover image URL for the post
string
Custom Open Graph image (falls back to coverImage)
string
Name of the blog series this post belongs to
number
required
Estimated reading time in minutes
CollectionEntry<'sponsors'>[]
Array of sponsor entries to display in sidebar
Related blog posts to show at the end
string
Canonical URL for cross-posted content
Usage Example
src/pages/blog/[slug].astro
Layout Structure
Creating Custom Layouts
You can create specialized layouts for different content types:1
Create layout file
Create a new file in
src/layouts/:2
Import base layout
Extend the base layout for consistency:
src/layouts/ProjectLayout.astro
3
Use your layout
src/pages/projects/my-app.astro
Customizing Existing Layouts
Modify Navigation
Add custom navigation items to all pages:src/layouts/Layout.astro
Add Analytics
Integrate additional analytics beyond GTM:src/layouts/Layout.astro
Customize Blog Content Styling
Modify the blog content prose styles:src/layouts/BlogLayout.astro
Layout Best Practices
Consistent metadata: Always provide title and description props for better SEO.
Canonical URLs: Set canonical URLs for pages with duplicate content or cross-posted articles.
Image optimization: Use optimized images for Open Graph previews (1200x630px recommended).
View Transitions
Both layouts include Astro’s view transitions for smooth page navigation:Structured Data
The base layout includes JSON-LD structured data for rich search results:src/layouts/Layout.astro:100-170
Next Steps
Customize Components
Learn how to modify individual components
Styling Guide
Customize colors and themes
Site Config
Update your site configuration
Content Collections
Manage your blog posts and content