mirror of
https://github.com/danpros/htmly.git
synced 2026-04-21 13:06:22 +05:30
Improve RSS feed
Improve RSS feed, adding sitemap and markup.
This commit is contained in:
parent
0f53d0de69
commit
bd66a69ad5
5 changed files with 39 additions and 5 deletions
|
|
@ -935,12 +935,36 @@ function generate_rss($posts){
|
|||
->appendTo($feed);
|
||||
|
||||
foreach($posts as $p){
|
||||
|
||||
$item = new Item();
|
||||
$item
|
||||
->title($p->title)
|
||||
->pubDate($p->date)
|
||||
->description($p->body)
|
||||
->url($p->url)
|
||||
->category($p->tag, $p->tagurl)
|
||||
->appendTo($channel);
|
||||
}
|
||||
|
||||
echo $feed;
|
||||
}
|
||||
|
||||
// Turn an array of posts into an RSS feed for sitemap
|
||||
function generate_sitemap($posts){
|
||||
|
||||
$feed = new Feed();
|
||||
$channel = new Channel();
|
||||
|
||||
$channel
|
||||
->title(config('blog.title'))
|
||||
->description(config('blog.description'))
|
||||
->url(site_url())
|
||||
->appendTo($feed);
|
||||
|
||||
foreach($posts as $p){
|
||||
$item = new Item();
|
||||
$item
|
||||
->title($p->title)
|
||||
->url($p->url)
|
||||
->appendTo($channel);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue