Add continue reading button to feed items
This commit is contained in:
parent
e5de558958
commit
6cbac34f2d
2 changed files with 10 additions and 3 deletions
9
website/common/templates/feed-description.html
Normal file
9
website/common/templates/feed-description.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{% load wagtailcore_tags %}
|
||||||
|
|
||||||
|
{% spaceless %}
|
||||||
|
{{ obj.content_html | truncatewords_html:75 | safe }}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="{% fullpageurl obj %}">Continue Reading…</a>
|
||||||
|
</p>
|
||||||
|
{% endspaceless %}
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue