Add image to RSS feed

This commit is contained in:
swag 2023-06-01 22:02:33 -04:00
parent 7ea6258a54
commit 5f7ae2c04d
2 changed files with 12 additions and 1 deletions

View File

@ -94,6 +94,8 @@ sub feed($self) {
my $rss = XML::RSS->new(version => '2.0'); my $rss = XML::RSS->new(version => '2.0');
my $chan_link = $self->url_for(threads_list => {list_page => 1} )->to_abs; my $chan_link = $self->url_for(threads_list => {list_page => 1} )->to_abs;
my $rss_link = $self->url_for(threads_feed => {format => 'rss'})->to_abs; my $rss_link = $self->url_for(threads_feed => {format => 'rss'})->to_abs;
my $rss_title = 'Post::Text';
my $rss_image = $self->url_for('/images/logo_small.png')->to_abs;
$rss->add_module( $rss->add_module(
prefix => 'atom', prefix => 'atom',
@ -101,7 +103,7 @@ sub feed($self) {
); );
$rss->channel( $rss->channel(
title => 'Post::Text', title => $rss_title,
description => 'In UTF-8 we trust. 🫡', description => 'In UTF-8 we trust. 🫡',
link => $chan_link, link => $chan_link,
lastBuildDate => time2str('%a, %d %b %Y %X %z', time), lastBuildDate => time2str('%a, %d %b %Y %X %z', time),
@ -113,6 +115,15 @@ sub feed($self) {
} }
}); });
$rss->image(
title => $rss_title,
url => $rss_image,
link => $rss_link,
width => 144,
height => 144,
description => 'A small nerdy anime girl'
);
for my $thread (@{$threads}) { for my $thread (@{$threads}) {
my $description = $self->markdown($thread->{'body'}); my $description = $self->markdown($thread->{'body'});
my $item_link = $self->url_for( my $item_link = $self->url_for(

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB