Add continue reading button to feed items

This commit is contained in:
Jake Howard 2024-03-31 23:59:56 +01:00
parent e5de558958
commit 6cbac34f2d
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 10 additions and 3 deletions

View file

@ -0,0 +1,9 @@
{% load wagtailcore_tags %}
{% spaceless %}
{{ obj.content_html | truncatewords_html:75 | safe }}
<p>
<a href="{% fullpageurl obj %}">Continue Reading&hellip;</a>
</p>
{% endspaceless %}

View file

@ -64,6 +64,7 @@ class KeybaseView(TemplateView):
class AllPagesFeed(Feed): class AllPagesFeed(Feed):
feed_type = CustomFeed feed_type = CustomFeed
link = "/" link = "/"
description_template = "feed-description.html"
def __init__(self) -> None: def __init__(self) -> None:
self.style_tag = f'<?xml-stylesheet href="{static("contrib/pretty-feed-v3.xsl")}" type="text/xsl"?>'.encode() self.style_tag = f'<?xml-stylesheet href="{static("contrib/pretty-feed-v3.xsl")}" type="text/xsl"?>'.encode()
@ -123,9 +124,6 @@ class AllPagesFeed(Feed):
def item_updateddate(self, item: BasePage) -> datetime: def item_updateddate(self, item: BasePage) -> datetime:
return item.last_published_at return item.last_published_at
def item_description(self, item: BasePage) -> str:
return getattr(item, "summary", None) or item.title
def item_categories(self, item: BasePage) -> Optional[list[str]]: def item_categories(self, item: BasePage) -> Optional[list[str]]:
if isinstance(item, BlogPostPage): if isinstance(item, BlogPostPage):
return item.tags_list.values_list("slug", flat=True) return item.tags_list.values_list("slug", flat=True)