Skip to content

Commit c98d534

Browse files
committed
feat: initial commit for simple redirect service
0 parents  commit c98d534

File tree

8 files changed

+385
-0
lines changed

8 files changed

+385
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: documentation
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
- name: Sphinx build
17+
run: |
18+
uv run sphinx-build doc _build
19+
- name: Deploy to GitHub Pages
20+
uses: peaceiris/actions-gh-pages@v3
21+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
22+
with:
23+
publish_branch: gh-pages
24+
github_token: ${{ secrets.GITHUB_TOKEN }}
25+
publish_dir: _build/
26+
force_orphan: true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_build/
2+
.venv/
3+
*.pyc
4+
__pycache__/
5+
.DS_Store

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Redirect Service
2+
3+
A simple sphinx-based redirect service using `sphinx-reredirects`.
4+
5+
## Available Redirects
6+
7+
See `conf.py` for the list of available redirects.
8+
9+
## Adding Redirects
10+
11+
Edit `conf.py` and add entries to the `redirects` dictionary with a `/index` suffix.
12+
13+
```python
14+
redirects = {
15+
"new-redirect/index": "https://example.com",
16+
}
17+
```
18+
19+
This will create a redirect from `https://go.pypsa.org/new-redirect` to `https://example.com` and the url can be used anywhere.

conf.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
3+
# -- Project information -----------------------------------------------------
4+
project = 'PyPSA Redirects'
5+
copyright = '2025, PyPSA'
6+
author = 'PyPSA'
7+
8+
# -- General configuration ---------------------------------------------------
9+
extensions = [
10+
'sphinx_reredirects',
11+
]
12+
13+
templates_path = ['_templates']
14+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
15+
16+
# -- Options for HTML output ------------------------------------------------
17+
html_theme = 'basic'
18+
html_static_path = []
19+
20+
# -- Redirects configuration ------------------------------------------------
21+
redirects = {
22+
"test-redirect/index": "https://google.com"
23+
}

index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PyPSA Redirect Service
2+
======================
3+
4+
See `https://github.com/PyPSA/redirect-service`.

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "redirect-service"
3+
version = "0.1.0"
4+
description = "Simple redirect service"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"sphinx==8.2.3",
9+
"sphinx-reredirects==1.0.0",
10+
]

uv.lock

Lines changed: 297 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)