4.5 KiB
| layout | title | publishDate | description | tags | |||||
|---|---|---|---|---|---|---|---|---|---|
| @/layouts/Post.astro | Getting Started with Poisson Astro Template | 2025-06-07 | This article will guide trough the configuration of the Astro template for Poisson |
|
Getting Started
-
Clone or download this template
git clone https://git.phc.dm.unipi.it/phc/poisson-template-astro.git cd poisson-template-astro -
Install dependencies:
npm install # or bun install -
To edit the site locally:
npm run dev -
Edit the configuration:
- Update
src/config.tswith your information - Modify the site title and other settings
- Update
-
Add your content:
- Create posts in
src/pages/posts/ - Add notes in
src/pages/appunti/ - Include any static files in
public/materiale/
- Create posts in
Content Creation
Blog Posts
Create new markdown posts in src/pages/posts/ with the following frontmatter:
---
title: 'Your Post Title'
description: 'Brief description of the post'
tags: ['tag1', 'tag2']
publishDate: '2025-06-08'
draft: false
---
Your content goes here...
Mathematical Content
The template supports mathematical expressions using KaTeX:
-
Inline math:
$E = mc^2$ -
Display math:
$$\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$
Deployment
Deploy to Poisson Server
The template is pre-configured for deployment to the PHC Poisson server:
-
Build for Poisson:
npm run build:poisson -
Update the Poisson configuration:
- Edit the
build:poissonscript inpackage.json - Replace
ncognomewith your actual username - Update the site URL accordingly
- Edit the
-
Upload the built files:
-
The build creates a
dist/folder -
Upload the contents to your Poisson web directory, for example using
scp:scp -r dist/* ncognome@poisson.phc.dm.unipi.it:/home/ncognome/public_html/or with
rsync:rsync -avz dist/ ncognome@poisson.phc.dm.unipi.it:/home/ncognome/public_html/
-
-
Access your site:
- Visit
https://poisson.phc.dm.unipi.it/~ncognome/to see your deployed site
- Visit
Deploy to GitHub Pages
For GitHub Pages deployment, follow these steps:
-
Configure Astro for GitHub Pages:
Update
astro.config.mjsto include your GitHub Pages settings:export default defineConfig({ site: 'https://yourusername.github.io', base: '/your-repo-name', // Only if not deploying to yourusername.github.io // ... other config }) -
Create GitHub Action workflow:
Create
.github/workflows/deploy.yml:name: Deploy to GitHub Pages on: push: branches: [main] workflow_dispatch: permissions: contents: read pages: write id-token: write jobs: build: runs-on: ubuntu-latest steps: - name: Checkout your repository using git uses: actions/checkout@v4 - name: Install, build, and upload your site uses: withastro/action@v3 deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 -
Enable GitHub Pages:
- Go to your repository's Settings → Pages
- Select GitHub Actions as the source
- Commit and push your changes
-
Configure for custom domain (optional):
- Add a
CNAMEfile in thepublic/directory with your domain - Update the
siteconfig to use your custom domain - Remove the
baseconfiguration
- Add a
Configuration Options
Site Configuration
Edit src/config.ts to customize:
- Site title
- Post frontmatter types
- Other site-wide settings
Build Scripts
npm run dev- Start development servernpm run build- Build for productionnpm run build:poisson- Build for Poisson server deploymentnpm run preview- Preview the built site
Contributing
This template is designed for academic use at the University of Pisa. Feel free to customize and extend it for your needs.