From cf38b8710aea19f966d75347e3a958f1b76f4626 Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Sun, 8 Jun 2025 01:13:32 +0200 Subject: [PATCH] more updates --- README.md | 241 +++++++++ astro.config.mjs | 3 + package.json | 2 +- {src => public}/materiale/dispensa-1.pdf | Bin src/components/PostCard.astro | 10 + src/layouts/Base.astro | 18 +- src/layouts/Post.astro | 33 ++ src/pages/appunti/index.astro | 44 -- src/pages/appunti/index.md | 34 ++ src/pages/posts/getting-started-with-astro.md | 123 +++++ src/pages/posts/index.astro | 3 + src/pages/posts/tags/[tag].astro | 96 ++++ src/pages/posts/tags/index.astro | 50 ++ src/style.css | 5 - src/themes/base.css | 382 ++----------- src/themes/colorful.css | 200 +++---- src/themes/modern.css | 381 +++++++++++++ src/themes/mono.css | 159 ++---- src/themes/sober.css | 511 ++++++++++++++++++ 19 files changed, 1703 insertions(+), 592 deletions(-) rename {src => public}/materiale/dispensa-1.pdf (100%) delete mode 100644 src/pages/appunti/index.astro create mode 100644 src/pages/appunti/index.md create mode 100644 src/pages/posts/getting-started-with-astro.md create mode 100644 src/pages/posts/tags/[tag].astro create mode 100644 src/pages/posts/tags/index.astro delete mode 100644 src/style.css create mode 100644 src/themes/modern.css create mode 100644 src/themes/sober.css diff --git a/README.md b/README.md index 1a18921..5c2b348 100644 --- a/README.md +++ b/README.md @@ -1 +1,242 @@ # Poisson Blog Template + +An Astro-based academic blog template designed for the PHC (Dipartimento di Matematica) at University of Pisa. This template provides a clean, mathematical content-friendly platform for sharing academic posts, notes, and research materials. + +## Features + +- ✨ Built with [Astro](https://astro.build/) for fast, static site generation + +- 📝 Support for Markdown and MDX content with mathematical expressions + +- 🎨 Multiple customizable themes + +- 🏷️ Tag-based post organization + +- 📚 Dedicated sections for posts and notes + +- 🔍 SEO-friendly structure + +- 📱 Responsive design + +## Available Themes + +The template includes several pre-built themes located in `src/themes/`: + +- **base.css** - Clean, minimal base theme + +- **colorful.css** - Vibrant, colorful theme + +- **modern.css** - Contemporary design with modern styling + +- **mono.css** - Monochromatic, minimalist theme + +- **sober.css** - Professional, academic-focused theme + +To change themes, modify the CSS import in `src/layouts/Base.astro`. + +## Project Structure + +``` +/ +├── public/ +│ ├── favicon.svg +│ └── materiale/ # Static files and documents +├── src/ +│ ├── components/ # Reusable Astro components +│ ├── layouts/ # Page layouts +│ ├── pages/ +│ │ ├── index.astro # Homepage +│ │ ├── appunti/ # Notes section +│ │ └── posts/ # Blog posts +│ ├── themes/ # CSS theme files +│ └── config.ts # Site configuration +├── astro.config.mjs # Astro configuration +└── package.json +``` + +## Getting Started + +1. **Clone or download this template** + + ```bash + git clone https://git.phc.dm.unipi.it/phc/poisson-template-astro.git + cd poisson-template-astro + ``` + +2. **Install dependencies:** + + ```bash + npm install + # or + bun install + ``` + +3. **To edit the site locally:** + + ```bash + npm run dev + ``` + +4. **Edit the configuration:** + + - Update `src/config.ts` with your information + - Modify the site title and other settings + +5. **Add your content:** + + - Create posts in `src/pages/posts/` + - Add notes in `src/pages/appunti/` + - Include any static files in `public/materiale/` + +## Content Creation + +### Blog Posts + +Create new markdown posts in `src/pages/posts/` with the following frontmatter: + +```markdown +--- +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](https://katex.org/): + +- 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: + +1. **Build for Poisson:** + + ```bash + npm run build:poisson + ``` + +2. **Update the Poisson configuration:** + + - Edit the `build:poisson` script in `package.json` + - Replace `ncognome` with your actual username + - Update the site URL accordingly + +3. **Upload the built files:** + + - The build creates a `dist/` folder + - Upload the contents to your Poisson web directory, for example using `scp`: + + ```bash + scp -r dist/* ncognome@poisson.phc.dm.unipi.it:/home/ncognome/public_html/ + ``` + + or with `rsync`: + + ```bash + rsync -avz dist/ ncognome@poisson.phc.dm.unipi.it:/home/ncognome/public_html/ + ``` + +4. **Access your site:** + + - Visit `https://poisson.phc.dm.unipi.it/~ncognome/` to see your deployed site + +### Deploy to GitHub Pages + +For GitHub Pages deployment, follow these steps: + +1. **Configure Astro for GitHub Pages:** + + Update `astro.config.mjs` to include your GitHub Pages settings: + + ```javascript + export default defineConfig({ + site: 'https://yourusername.github.io', + base: '/your-repo-name', // Only if not deploying to yourusername.github.io + // ... other config + }) + ``` + +2. **Create GitHub Action workflow:** + + Create `.github/workflows/deploy.yml`: + + ```yaml + 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 + ``` + +3. **Enable GitHub Pages:** + + - Go to your repository's **Settings** → **Pages** + - Select **GitHub Actions** as the source + - Commit and push your changes + +4. **Configure for custom domain (optional):** + - Add a `CNAME` file in the `public/` directory with your domain + - Update the `site` config to use your custom domain + - Remove the `base` configuration + +## 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 server +- `npm run build` - Build for production +- `npm run build:poisson` - Build for Poisson server deployment +- `npm 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. + +## License + +This template is provided as-is for educational and academic purposes. diff --git a/astro.config.mjs b/astro.config.mjs index 68a4c09..212f4c8 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -13,6 +13,9 @@ export default defineConfig({ }, markdown: { remarkPlugins: [remarkMath], + remarkRehype: { + passThrough: ['html'], + }, shikiConfig: { theme: 'github-light', }, diff --git a/package.json b/package.json index 1ae6bfc..522a786 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "theme-poisson-blog", + "name": "poisson-template-astro", "type": "module", "version": "0.0.1", "scripts": { diff --git a/src/materiale/dispensa-1.pdf b/public/materiale/dispensa-1.pdf similarity index 100% rename from src/materiale/dispensa-1.pdf rename to public/materiale/dispensa-1.pdf diff --git a/src/components/PostCard.astro b/src/components/PostCard.astro index 9612ffb..825de2d 100644 --- a/src/components/PostCard.astro +++ b/src/components/PostCard.astro @@ -5,6 +5,7 @@ type Props = { publishDate: string description: string url: string + tags?: string[] } } @@ -32,4 +33,13 @@ const { post } = Astro.props
{post.description}
+
+ { + post.tags?.map(tag => ( + + #{tag} + + )) + } +
diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 463cbd7..15122f3 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -1,8 +1,16 @@ --- +import config from '@/config' import 'katex/dist/katex.min.css' -import '@/style.css' +import '@/themes/base.css' -import config from '@/config' +// +// Uncomment below the theme you want to use +// + +import '@/themes/modern.css' +// import '@/themes/colorful.css' +// import '@/themes/mono.css' +// import '@/themes/sober.css' --- @@ -13,7 +21,7 @@ import config from '@/config'