Spaces:
Sleeping
Sleeping
Templates Directory
This directory contains Jinja2 HTML templates for the SwiftOps API.
Structure
templates/
├── base.html # Base template with common layout
└── index.html # Landing page template
Usage
Templates are rendered using FastAPI's Jinja2Templates:
from fastapi.templating import Jinja2Templates
templates = Jinja2Templates(directory="templates")
@router.get("/")
async def index(request: Request):
return templates.TemplateResponse("index.html", {
"request": request,
"app_name": "SwiftOps API"
})
Adding New Templates
- Create a new HTML file in this directory
- Extend
base.htmlfor consistent layout:
{% extends "base.html" %}
{% block title %}Your Page Title{% endblock %}
{% block content %}
<!-- Your content here -->
{% endblock %}
- Add a route in
app/api/v1/pages.py
Template Variables
Common variables available in templates:
app_name- Application nameapp_version- Current versionapp_description- Short descriptioncurrent_year- Current year for copyrightgithub_url- GitHub repository URLendpoints- List of available endpoints
Styling
CSS is located in static/css/main.css and automatically supports:
- Light/Dark mode (system preference)
- Responsive design
- Smooth animations