diff --git a/feeds/views.py b/feeds/views.py index cac3960..a018c9a 100644 --- a/feeds/views.py +++ b/feeds/views.py @@ -21,6 +21,10 @@ class IndexView(View): context = { "db_size": get_db_size(), "amount_of_feeds": Feed.objects.count(), + "description": "FeedVault allows users to archive and search their favorite web feeds.", + "keywords": "feed, rss, atom, archive, rss list", + "author": "TheLovinator", + "canonical": "https://feedvault.se/", } return HttpResponse(content=template.render(context=context, request=request)) @@ -37,7 +41,17 @@ class FeedView(View): feed = get_object_or_404(Feed, id=feed_id) entries = Entry.objects.filter(feed=feed).order_by("-created_parsed")[:100] - context = {"feed": feed, "entries": entries, "db_size": get_db_size(), "amount_of_feeds": Feed.objects.count()} + context = { + "feed": feed, + "entries": entries, + "db_size": get_db_size(), + "amount_of_feeds": Feed.objects.count(), + "description": f"Archive of {feed.href}", + "keywords": "feed, rss, atom, archive, rss list", + "author": f"{feed.author_detail.name if feed.author_detail else "FeedVault"}", + "canonical": f"https://feedvault.se/feed/{feed_id}/", + } + return render(request, "feed.html", context) @@ -54,6 +68,10 @@ class FeedsView(ListView): context = super().get_context_data(**kwargs) context["db_size"] = get_db_size() context["amount_of_feeds"] = Feed.objects.count() + context["description"] = "Archive of all feeds" + context["keywords"] = "feed, rss, atom, archive, rss list" + context["author"] = "TheLovinator" + context["canonical"] = "https://feedvault.se/feeds/" return context @@ -66,11 +84,19 @@ class AddView(View): context = { "db_size": get_db_size(), "amount_of_feeds": Feed.objects.count(), + "description": "FeedVault allows users to archive and search their favorite web feeds.", + "keywords": "feed, rss, atom, archive, rss list", + "author": "TheLovinator", + "canonical": "https://feedvault.se/", } return HttpResponse(content=template.render(context=context, request=request)) def post(self, request: HttpRequest) -> HttpResponse: """Add a feed.""" + + # Temporary turn off the /add page. + return HttpResponse(content="Not available", status=404) + urls: str | None = request.POST.get("urls", None) if not urls: return HttpResponse(content="No urls", status=400) diff --git a/feedvault/settings.py b/feedvault/settings.py index 795d41d..137cbca 100644 --- a/feedvault/settings.py +++ b/feedvault/settings.py @@ -16,9 +16,6 @@ BASE_DIR: Path = Path(__file__).resolve().parent.parent # The secret key is used for cryptographic signing, and should be set to a unique, unpredictable value. SECRET_KEY: str = os.getenv("SECRET_KEY", default="") -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - ALLOWED_HOSTS = [] INSTALLED_APPS = [ diff --git a/templates/base.html b/templates/base.html index 3ba357e..c77376e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,10 +3,10 @@ - - - - + {% if description %}{% endif %} + {% if keywords %}{% endif %} + {% if author %}{% endif %} + {% if canonical %}{% endif %} {% if title %} {{ title }} {% else %}