Revista is a sophisticated photography portfolio and blog built using the Astro framework. It showcases various collections of photographs and written content, organized into different categories such as long-form, short-form, muses, and zeitweilig. The project emphasizes performance, aesthetic presentation, and efficient content management.
graph TD
A[Root] --> B[src]
A --> C[public]
A --> D[Configuration Files]
B --> E[components]
B --> F[layouts]
B --> G[pages]
B --> H[content]
B --> I[styles]
B --> J[scripts]
H --> K[long_form]
H --> L[short_form]
H --> M[muses]
H --> N[zeitweilig]
H --> O[authors]
H --> P[cv]
E --> E1[BlogPost.astro]
E --> E2[Footer.astro]
E --> E3[Header.astro]
E --> E4[Navigation.astro]
F --> F1[BaseLayout.astro]
F --> F2[MarkdownPostLayout.astro]
G --> G1[index.astro]
G --> G2[404.astro]
G --> G3[cv.astro]
I --> I1[global.css]
I --> I2[MasonryLayout.css]
J --> J1[menu.js]
J --> J2[themetoggle.js]
src/
: Contains the main source code for the sitecomponents/
: Reusable Astro componentsBlogPost.astro
: Component for rendering individual blog post previewsFooter.astro
: Site-wide footer componentHeader.astro
: Site-wide header componentNavigation.astro
: Navigation menu component
layouts/
: Page layouts used across the siteBaseLayout.astro
: The main layout used by most pagesMarkdownPostLayout.astro
: Layout for rendering Markdown content
pages/
: Astro pages that generate routesindex.astro
: The home page404.astro
: Custom 404 error pagecv.astro
: CV page
content/
: Markdown content for blog posts and collectionsstyles/
: CSS files for stylingglobal.css
: Global styles and Tailwind importsMasonryLayout.css
: Styles for the masonry layout used in galleries
scripts/
: JavaScript files for client-side functionalitymenu.js
: Handles mobile menu functionalitythemetoggle.js
: Manages dark/light theme toggling
public/
: Static assets like images and fonts- Configuration files:
astro.config.mjs
: Astro configurationtailwind.config.mjs
: Tailwind CSS configurationtsconfig.json
: TypeScript configuration
-
Multiple Content Collections: The site is organized into different content types (long_form, short_form, muses, zeitweilig, authors), each managed as an Astro content collection. This allows for type-safe content management and easy querying.
-
Responsive Design: Utilizes Tailwind CSS for a mobile-first, responsive layout. The design adapts seamlessly from mobile devices to large desktop screens.
-
Dark Mode: Supports both light and dark themes, with a toggle functionality implemented in
themetoggle.js
. The theme preference is stored in localStorage for persistence across visits. -
Dynamic Routing: Generates routes based on content collections. This includes dynamic routes for individual posts and tag pages.
-
RSS Feeds: Provides RSS feeds for each content collection, allowing users to subscribe to updates. The feeds are generated dynamically using
@astrojs/rss
. -
SEO Optimized: Includes metadata and structured data for better search engine visibility. Each page has customizable meta tags for title, description, and Open Graph data.
-
Performance Optimized: Uses Astro's static site generation for fast loading times. Additionally, implements lazy loading for images and prefetching for improved navigation performance.
-
Interactive Components: Incorporates client-side JavaScript for enhanced user experience, including a mobile menu, theme toggle, and image lightbox functionality.
-
Custom 404 Page: Features a unique 404 error page with quotes from Ron Burgundy, adding a touch of humor to the user experience when encountering missing pages.
-
CV Section: Includes a dedicated CV page, demonstrating the versatility of the platform for personal branding and professional presentation.
Content is managed through Markdown files located in the src/content/
directory. Each content type (e.g., long_form, short_form) has its own subdirectory.
graph TD
A[content] --> B[long_form]
A --> C[short_form]
A --> D[muses]
A --> E[zeitweilig]
A --> F[authors]
A --> G[cv]
B --> H[post1.md]
B --> I[post2.md]
C --> J[post1.md]
C --> K[post2.md]
D --> L[post1.md]
E --> M[post1.md]
F --> N[author1.md]
G --> O[resume.md]
Each Markdown file contains frontmatter with metadata such as title, publication date, tags, and image information. The content collections are defined in src/content/config.ts
, which specifies the schema for each collection using Zod for runtime type checking.
Routing in this Astro project is handled through a combination of file-based routing and dynamic route generation. Here's a simplified overview of the route structure:
graph TD
A[Root] --> B[404]
A --> C[authors]
A --> D[cv]
A --> E[long_form]
A --> F[short_form]
A --> G[muses]
A --> H[zeitweilig]
E --> I[long_form post]
E --> J[long_form tags]
J --> K[long_form tag]
F --> L[short_form post]
F --> M[short_form tags]
M --> N[short_form tag]
G --> O[muses post]
G --> P[muses tags]
P --> Q[muses tag]
H --> R[zeitweilig post]
H --> S[zeitweilig tags]
S --> T[zeitweilig tag]
-
Root and Static Routes:
/
: Home page (src/pages/index.astro
)/404
: Custom 404 error page (src/pages/404.astro
)/authors
: Authors page (src/pages/authors.astro
)/cv
: CV page (src/pages/cv.astro
)
-
Collection Routes: For each collection (long_form, short_form, muses, zeitweilig):
/{collection}
: Index page for the collection (src/pages/{collection}/index.astro
)/{collection}/post-id
: Individual post pages (src/pages/{collection}/[...id].astro
)/{collection}/tags
: Tag index for the collection (src/pages/{collection}/tags/index.astro
)/{collection}/tags/tag-name
: Pages for specific tags (src/pages/{collection}/tags/[tag].astro
)
-
Dynamic Route Generation:
- Post pages (e.g.,
/long_form/post-id
) are generated dynamically based on the content in the respective collection usinggetStaticPaths()
in[...id].astro
. - Tag pages (e.g.,
/long_form/tags/tag-name
) are generated for each unique tag used in the collection, also usinggetStaticPaths()
in[tag].astro
.
- Post pages (e.g.,
-
RSS Feeds:
- Each collection has an RSS feed available at
/{collection}/rss.xml
, generated byrss.xml.js
files in each collection's directory.
- Each collection has an RSS feed available at
This routing structure is implemented through a combination of static files in the src/pages
directory and dynamic route generation using Astro's getStaticPaths
function in the respective page components.
The project uses Tailwind CSS for styling, with custom configurations in tailwind.config.mjs
. Key styling features include:
-
Custom Font Configuration: Uses "Overpass Mono Variable" and "Inconsolata Variable" fonts, configured in the Tailwind theme.
-
Custom Utilities: Defines custom utilities for object positioning and background sizing.
-
Typography Plugin: Utilizes
@tailwindcss/typography
plugin for rich text styling. -
Dark Mode: Configured to use the
class
strategy for dark mode, allowing for dynamic theme switching. -
Custom Breakpoints: Defines custom breakpoints for responsive design (sm: 800px, md: 1200px, lg: 1900px, xl: 2500px, 2xl: 3800px).
Additional styles are defined in src/styles/
:
global.css
: Contains global styles and Tailwind directives.MasonryLayout.css
: Defines styles for the masonry layout used in image galleries.
Client-side functionality is handled by JavaScript files in the src/scripts/
directory, including:
themetoggle.js
: Manages dark/light theme toggling and persistence.menu.js
: Handles the mobile navigation menu toggle.lightbox.js
: Implements a lightbox feature for image galleries using GLightbox.burgundy.js
: Generates random Ron Burgundy quotes for the 404 page.rss.js
: Manages visibility of RSS links based on the current page.homePage.js
: Handles random image selection for the homepage.
The project implements several performance optimization techniques:
-
Image Optimization: Uses Astro's
getImage
function to optimize images, converting them to the AVIF format and setting appropriate dimensions. -
Lazy Loading: Images are set to load lazily using the
loading="lazy"
attribute, improving initial page load times. -
Preloading and Prefetching: Utilizes Astro's
prefetch
feature to improve navigation performance between pages. -
Efficient Bundling: Astro's built-in bundling and tree-shaking ensure only necessary code is sent to the client.
-
Caching Strategy: Implements caching headers and Cloudflare's CDN for improved content delivery speed.
The project implements a search feature using Pagefind, allowing users to search through the site's content easily. The search component is integrated into the Navigation.astro
component.
While the primary language is English, the project structure supports potential multilingual content:
- The RSS feeds are set up with language tags (
<language>en-us</language>
). - The content structure allows for easy addition of localized content in the future.
-
Cloudflare:
- Used for hosting and CDN services.
- Cache purging is implemented in the CI/CD pipeline to ensure fresh content delivery.
-
Deno Deploy:
- Serves as an additional deployment target.
- Demonstrates the project's versatility in hosting options.
-
Bun:
- Used as the JavaScript runtime and package manager.
- Offers improved performance over traditional Node.js and npm.
- All scripts in
package.json
are run using Bun.
-
TypeScript:
- The project includes TypeScript configurations (
tsconfig.json
). - Enables type-safe development practices.
- The project includes TypeScript configurations (
-
Prettier:
- Used for code formatting, ensuring consistent code style across the project.
-
ESLint:
- While not explicitly configured, the project structure suggests its potential use for code linting.
The project uses GitHub Actions for continuous integration and deployment, defined in .github/workflows/deploy.yml
. Key steps include:
-
Build Revista:
- Uses Bun for dependency installation and build process.
- Implements caching for faster builds.
- Includes retry logic for build reliability.
-
Deploy to Deno:
- Utilizes Deno Deploy for hosting.
-
Deploy to Cloudflare:
- Deploys to Cloudflare Pages using Wrangler.
-
Docker Image Handling:
- Builds a multi-architecture Docker image.
- Pushes the image to Docker Hub.
- Signs the Docker image using Cosign for security.
-
Cache Management:
- Purges Cloudflare cache after successful deployment.
The project includes a Dockerfile for containerization:
FROM caddy:2.8.4-alpine
WORKDIR /usr/share/caddy
COPY ./dist .
COPY Caddyfile /etc/caddy/Caddyfile
RUN chown -R root:root /usr/share/caddy && \
chmod -R 755 /usr/share/caddy
EXPOSE 80
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
This setup:
- Uses Caddy as the web server.
- Copies the built Astro site and Caddy configuration.
- Sets appropriate permissions.
- Exposes port 80 for web traffic.
-
Docker Image Signing: The CI/CD pipeline includes steps to sign the Docker image using Cosign, enhancing deployment security.
-
Content Security: Uses
sanitize-html
in RSS feed generation to prevent XSS vulnerabilities. -
Secure Hosting: Leverages Cloudflare's security features for DDoS protection and SSL.
For development, ensure you have:
- Bun (latest version)
- Node.js (LTS version recommended)
- Git
- A code editor (VS Code recommended with Astro extension)
To get started with this project:
-
Clone the repository:
git clone https://github.com/your-username/revista.git cd revista
-
Install dependencies:
bun install
-
Run the development server:
bun run dev
-
Build for production:
bun run build
-
Preview the production build:
bun run preview
The project supports multiple deployment options:
- Cloudflare Pages (primary)
- Deno Deploy
- Docker container (deployable to any container hosting service)
When contributing:
- Familiarize yourself with Astro, especially content collections and routing.
- Follow the existing code style and use Tailwind CSS for styling.
- Test changes thoroughly, including on different device sizes.
- Update or add tests for new features.
- Update documentation, including this README, if necessary.
- Use Bun for running scripts and managing dependencies.
If you encounter issues:
- Ensure all dependencies are correctly installed (
bun install
). - Clear the Astro cache (
.astro
directory) for build errors. - Check the Astro Discord community for common issues and solutions.
- Verify that Bun is up to date and properly configured.
This project is licensed under the MIT License - see the LICENSE file for details.
Note: The blog content (posts, articles, images, etc.) is not covered by the MIT License. All rights to the content are reserved by the respective authors unless otherwise specified.
- Astro community for providing an excellent static site generator and helpful documentation.
- Tailwind CSS for their utility-first CSS framework.
- Cloudflare for hosting and CDN services.
- Deno Deploy for providing an additional deployment option.
- All contributors who have helped improve this project.
For any queries regarding this project, please open an issue on the GitHub repository.
While not explicitly defined in the project files, potential future enhancements could include:
- Implementing full internationalization support.
- Enhancing the search functionality with more advanced features.
- Integrating a headless CMS for easier content management.
- Implementing automated image optimization workflows.
- Adding more interactive elements to the gallery views.
Please note that these are speculative and would need to be confirmed with the project maintainers.
While not explicitly included in the project files, it's recommended to adhere to a standard code of conduct to ensure a welcoming and inclusive environment for all contributors and users.
This README is a living document and will be updated as the project evolves. Contributors are encouraged to suggest improvements or additions to keep it comprehensive and up-to-date.