This repository contains the source code for the IndieWebClub Bangalore website, a static site generated using Python. The website displays upcoming and past events, and a blogroll of recent posts from the community.
- Event feed and calendar
- Member blogroll page and feeds
- Member directory
- Webring
- CI/CD
- Python 3.x
make
-
Clone the repository:
git clone https://github.com/IndieWebClubBlr/website.git cd website -
Set up the environment and install dependencies: The
Makefileprovides a convenient way to set up a Python virtual environment and install the required dependencies fromrequirements.txt.make setup
You can run
makeormake helpat any time to see a list of all available commands. -
Activate the virtual environment if required:
source venv/bin/activate
The following commands are available through the Makefile.
make build: Build the website. This will generate the static files in the_sitedirectory. For faster builds during development, you can enable caching by runningmake build CACHE=true.make serve: Serve the website locally for development. You can view the site athttp://localhost:8000.make watch: Automatically rebuild the site when files change.
make install: Install or update dependencies ifrequirements.txtchanges.make clean: Remove the generated_sitedirectory.make clean_all: Perform a full cleanup, removing the_sitedirectory, thevenv, and the cache.
The website is generated by the generator.py script. This script performs the following steps:
- Parses
blogroll.opml: Reads the list of community blog feeds. - Fetches feeds: Concurrently fetches the content of each feed.
- Detects weeknotes: Automatically separates weeknote entries from regular blog posts based on title and tag patterns.
- Fetches events: Retrieves event information from the Underline Center Discourse API.
- Generates the homepage: Ggenerate the homepage with the aggregated content.
- Generated static pages: Converts Markdown files in the
pages/directory to static HTML pages. - Generates feeds and calendar: Creates Atom feeds for the blogroll and events, and an iCalendar file for events.
- Generates member directory: Creates a member directory page listing all community members.
- Generates webring: Creates webring redirect links that connect to random member websites.
The generated site is then deployed to the gh-pages branch of the repository.
The project's behavior can be customized through the config.py file. This file includes settings for request timeouts, content length limits, feed and calendar file names, and more. Some of the key options you might want to modify are:
MAX_SHOWN_POSTS_PER_FEED: The number of posts to display per blog on the homepage.MAX_FEED_ENTRY_AGE: The time window in days for fetching recent blog posts.MAX_FEED_ENTRIES: The maximum number of entries to fetch from each feed.
A brief overview of the project's file structure:
/
├── .github/ # GitHub Actions workflows for CI/CD.
├── _site/ # Output directory for the generated website.
├── assets/ # Static assets (CSS, SVG icons, PNG images).
│ ├── favicon.svg
│ ├── indiewebcamp-button.svg
│ ├── preview.png
│ └── style.css
├── pages/ # Markdown files for static pages.
│ ├── coc.md
│ └── webring.md
├── src/ # Python source code.
│ ├── __init__.py
│ ├── build.py # Pull-based build system for parallel task execution.
│ ├── config.py # Configuration constants for the project.
│ ├── events.py # Logic for fetching events from the Discourse API.
│ ├── feeds.py # Logic for fetching and parsing blogroll feeds.
│ ├── generator.py # Main script to generate the static site.
│ ├── member_dir.py # Logic for generating the member directory page.
│ └── utils.py # Shared utilities for templating and HTTP requests.
├── templates/ # HTML templates.
│ ├── default.html # Template for wrapping generated content with site layout.
│ ├── index.html # The pystache template for the homepage.
│ └── webring-redirect.html # Template for webring redirect pages.
├── CNAME # Custom domain configuration for GitHub Pages.
├── LICENSE # The license for the project.
├── README.md # This file.
├── Makefile # Contains all the commands for building, serving, and cleaning the project.
├── blogroll.opml # The list of feeds for the blogroll.
├── pyrightconfig.json # Configuration file for the Pyright type checker.
├── requirements.txt # Python dependencies for the project.
├── shell.nix # Nix shell configuration for reproducible development environments.
└── watch.sh # A script to watch for file changes and rebuild the site.
Contributions are welcome! Please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.