🔧 configurable comic title
This commit is contained in:
3
app.py
3
app.py
@@ -2,7 +2,7 @@ import os
|
||||
from datetime import datetime
|
||||
from flask import Flask, render_template, abort, jsonify, request
|
||||
from comics_data import (
|
||||
COMICS, FULL_WIDTH_DEFAULT, PLAIN_DEFAULT, HEADER_IMAGE, FOOTER_IMAGE,
|
||||
COMICS, COMIC_NAME, FULL_WIDTH_DEFAULT, PLAIN_DEFAULT, HEADER_IMAGE, FOOTER_IMAGE,
|
||||
COMPACT_FOOTER, ARCHIVE_FULL_WIDTH, USE_COMIC_NAV_ICONS, USE_HEADER_NAV_ICONS,
|
||||
USE_FOOTER_SOCIAL_ICONS, SOCIAL_INSTAGRAM, SOCIAL_YOUTUBE, SOCIAL_EMAIL,
|
||||
API_SPEC_LINK
|
||||
@@ -19,6 +19,7 @@ app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'your-secret-key')
|
||||
def inject_global_settings():
|
||||
"""Make global settings available to all templates"""
|
||||
return {
|
||||
'comic_name': COMIC_NAME,
|
||||
'header_image': HEADER_IMAGE,
|
||||
'footer_image': FOOTER_IMAGE,
|
||||
'compact_footer': COMPACT_FOOTER,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Comic data
|
||||
# Edit this file to add, remove, or modify comics
|
||||
|
||||
# Global setting: The name of your comic/website
|
||||
COMIC_NAME = 'Sunday Comics'
|
||||
|
||||
# Global setting: Set to True to make all comics full-width by default
|
||||
# Individual comics can override this with 'full_width': False
|
||||
FULL_WIDTH_DEFAULT = False
|
||||
|
||||
@@ -10,11 +10,11 @@ from xml.dom import minidom
|
||||
|
||||
# Add parent directory to path so we can import comics_data
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from comics_data import COMICS
|
||||
from comics_data import COMICS, COMIC_NAME
|
||||
|
||||
# Configuration - update these for your site
|
||||
SITE_URL = "http://localhost:3000" # Change to your actual domain
|
||||
SITE_TITLE = "Sunday Comics"
|
||||
SITE_TITLE = COMIC_NAME
|
||||
SITE_DESCRIPTION = "A webcomic about life, the universe, and everything"
|
||||
SITE_LANGUAGE = "en-us"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
'use strict';
|
||||
|
||||
let totalComics = 0;
|
||||
let comicName = ''; // Will be extracted from initial page title
|
||||
|
||||
// Fetch and display a comic
|
||||
async function loadComic(comicId) {
|
||||
@@ -109,7 +110,7 @@
|
||||
updateNavButtons(comic.number, comic.formatted_date);
|
||||
|
||||
// Update page title
|
||||
document.title = `${title} - Sunday Comics`;
|
||||
document.title = `${title} - ${comicName}`;
|
||||
|
||||
// Update URL without reload
|
||||
history.pushState({ comicId: comic.number }, '', `/comic/${comic.number}`);
|
||||
@@ -231,6 +232,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract comic name from initial page title (e.g., "Latest Comic - Sunday Comics" -> "Sunday Comics")
|
||||
const titleParts = document.title.split(' - ');
|
||||
if (titleParts.length > 1) {
|
||||
comicName = titleParts[titleParts.length - 1];
|
||||
}
|
||||
|
||||
// Get total comics count from the page
|
||||
totalComics = parseInt(document.querySelector('.comic-container').dataset.totalComics || 0);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: Sunday Comics API
|
||||
description: API for accessing webcomic data from the Sunday Comics platform
|
||||
title: Webcomic API
|
||||
description: API for accessing webcomic data
|
||||
version: 1.0.0
|
||||
contact:
|
||||
url: http://127.0.0.1:3000
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{{ title }}{% endblock %} - Sunday Comics</title>
|
||||
<title>{% block title %}{{ title }}{% endblock %} - {{ comic_name }}</title>
|
||||
|
||||
<!-- SEO Meta Tags -->
|
||||
<meta name="description" content="{% block meta_description %}A webcomic about life, the universe, and everything{% endblock %}">
|
||||
@@ -11,7 +11,7 @@
|
||||
<!-- Open Graph / Facebook -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="{% block meta_url %}{{ request.url }}{% endblock %}">
|
||||
<meta property="og:title" content="{% block og_title %}{{ self.title() }} - Sunday Comics{% endblock %}">
|
||||
<meta property="og:title" content="{% block og_title %}{{ self.title() }} - {{ comic_name }}{% endblock %}">
|
||||
<meta property="og:description" content="{% block og_description %}{{ self.meta_description() }}{% endblock %}">
|
||||
<meta property="og:image" content="{% block og_image %}{{ request.url_root }}static/images/default-preview.png{% endblock %}">
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="Sunday Comics RSS Feed" href="{{ url_for('static', filename='feed.rss') }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ comic_name }} RSS Feed" href="{{ url_for('static', filename='feed.rss') }}">
|
||||
{% block extra_css %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% if header_image %}
|
||||
<div class="site-header-image">
|
||||
<img src="{{ url_for('static', filename='images/' + header_image) }}" alt="Sunday Comics Header">
|
||||
<img src="{{ url_for('static', filename='images/' + header_image) }}" alt="{{ comic_name }} Header">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<div class="container">
|
||||
{% if not header_image %}
|
||||
<div class="nav-brand">
|
||||
<a href="{{ url_for('index') }}">Sunday Comics</a>
|
||||
<a href="{{ url_for('index') }}">{{ comic_name }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<ul class="nav-links">
|
||||
@@ -132,14 +132,14 @@
|
||||
</div>
|
||||
|
||||
<div class="footer-bottom">
|
||||
<p>© 2025 Sunday Comics. All rights reserved.</p>
|
||||
<p>© 2025 {{ comic_name }}. All rights reserved.</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{% if footer_image %}
|
||||
<div class="site-footer-image">
|
||||
<img src="{{ url_for('static', filename='images/' + footer_image) }}" alt="Sunday Comics Footer">
|
||||
<img src="{{ url_for('static', filename='images/' + footer_image) }}" alt="{{ comic_name }} Footer">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user