Unable to get page number from rss.
Please tell me how to solve it.
View in RSS
http://localhost:3000/articles/feed
<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<channel>
<title> 1K Extreme: Updates </title>
<link>https://www.onekextreme.com/</link>
<description>1K Extreme Blog: New </description>
<item>
<title> Cabbage</title>
<link>https://www.onekextreme.com/articles/#{article.id}</link>
<description>tesyqqqqqqqqqqqqqqqqqqq;/description>
<pubDate>2022-11-2709:18:24 + 0900</pubDate>
</item>
</channel>
</rss>
Regarding #{article.id}, I would like to display the id of the article, but
#{article.id} is displayed as is in text.
I would like to obtain the id number as follows.
<link>https://www.onekextreme.com/articles/80</link>
The view and controller are configured as follows:
views/articles/feed.rss.erb
<rss version='2.0'>
<channel>
<title> 1K Extreme: Updates </title>
<link>https://www.onekextreme.com/</link>
<description>1K Extreme Blog: New </description>
<%@articles.each do |article|%>
<item>
<title><%=article.title%></title>
<link>https://www.onekextreme.com/articles/#{article.id}</link>
<description><%=article.content1%></description>
<pubDate><%=article.created_at%>/pubDate>
</item>
<%end%>
</channel>
</rss>
articles_controller.rb
defeed
@articles=Article.all.order(created_at::desc).page(params[:page]).per(6)
end
<link>https://www.onekextreme.com/articles/<%=article.id%></link>
If you want to use URL helper
<link><%=article_url(article)%>/link>
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.