Skip to content

Instantly share code, notes, and snippets.

@TrywaR
Last active July 7, 2019 20:33
Show Gist options
  • Save TrywaR/627049950d86d7c725fe79a92b24ab38 to your computer and use it in GitHub Desktop.
Save TrywaR/627049950d86d7c725fe79a92b24ab38 to your computer and use it in GitHub Desktop.
MODX Evo > RSS для турбо-страниц хуяндекса

MODX Evo > RSS для турбо-страниц хуяндекса

  1. Создаём страницу типа XML с пустым шаблоном, в содержимое пихаем Содержимое страницы.xml и указываем в &parents id ресурсов откуда выводить материал
  2. Добавляем сниппет htmlspecialchars с кодом из htmlspecialchars.php для экранизации символов и добавление полного пути к картинкам, указываем папку с картинками
  3. Добавляем чанк tpl_turborss с кодом из rss_tpl.tpl для вывода элементов, заменяем код для вывода картинок на нужные tv и тд
<?
if (isset($content)){
$image_path = 'images'; # Папка с картинками
$output = str_replace( 'src="'.$image_path, 'src="[(site_url)]'.$image_path, $content );
$output = str_replace("\r\n", "", $output);
$output = htmlspecialchars($output);
return $output;
}
?>
<item turbo="true">
<title>[+rss_pagetitle+]</title>
<link>[(site_url)][~[+id+]~]</link>
<description>
<![CDATA[ [+introtext+] ]]>
</description>
<pubDate>[+rss_date+]</pubDate>
<turbo:content>
<header>
[[if? &is=`[*img*]:not_empty:or:[*imge*]:not_empty` &then=`
<figure>
<img src="[+img:default=`[+imge+]`+]" />
</figure>
`]]
<h1>
[+pagetitle+]
</h1>
</header>
<description>
[[htmlspecialchars? &content=`[+content+]`]]
</description>
</turbo:content>
<guid isPermaLink="false">[(site_url)][~[+id+]~]</guid>
</item>
[!Ditto?
&parents=`67,163`
&format=`rss`
&total=`all`
&tpl=`rss_tpl`
&display=`10`
!]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment