I use Drupal 8.7.11.
I personalized the RSS feed via a function in my theme my_theme_preprocess_views_view_row_rss()
in view.inc
file.
I added this to add content:encoded
tag in RSS feed called google_news.
if ($variables['row']->description['#view_mode'] === 'google_news') {
$variables['content_encoded'] = \Drupal::service('renderer')->render($node->get('field_mg_paragraph')->view('google_news'));
}
This code adds the content:encoded
tag to the RSS feed, but it only works with a few exceptions.
This works the first time you open the RSS feed /feeds/google-news.xml
page (directly by URL, without going through the site).
It no longer works when I refresh the page after visiting the home page of the site or a blog post while logged in as administrator / user.
I investigated, and a SESS cookie is placed in my browser, obviously, this cookie is problematic.
Anyone have any feedback on it?
If I am disconnected and that I delete cookies, or that I navigate in private navigation on Google Chrome, I do not have this problem of cookie placed in the browser, and therefore my code works, it adds the content:encoded
tag.
content: encoded
tag is well done, but when I refresh the page of the RSS feed, the tag disappears. It appears only once. An idea? – pirmax Feb 11 '20 at 8:29