Fix meta tags and disable adding feeds

This commit is contained in:
Joakim Hellsén 2024-02-19 07:40:04 +01:00
commit 4c41dda244
3 changed files with 31 additions and 8 deletions

View file

@ -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)