Skip to content

Instantly share code, notes, and snippets.

@eonarik
Last active July 27, 2019 08:01
Show Gist options
  • Save eonarik/cac42fcae39d0bc1ec326d3ce77da326 to your computer and use it in GitHub Desktop.
Save eonarik/cac42fcae39d0bc1ec326d3ce77da326 to your computer and use it in GitHub Desktop.
yandex turbo
requred pdoTools, phpthumbon, jevix
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" xmlns:turbo="http://turbo.yandex.ru" version="2.0">
<channel>
<title>[[++site_name]]</title>
<link>[[++site_url]]</link>
<description>[[#[[++site_start]].description]]</description>
[[!pdoResources?
&parents=`0`
&includeTVs=`image`
&processTVs=`image`
&where=`{ "content:!=": "", "class_key:!=": "modWebLink", "searchable": 1 }`
&includeContent=`1`
&limit=`1000`
&tpl=`turborss.item`
]]
</channel>
</rss>
<item turbo="true">
<link>[[~[[+id]]?scheme=`full`]]</link>
<title>{$longtitle ?: $pagetitle}</title>
<pubDate>{$publishedon | date : "D, d M Y G:i:s +0300"}</pubDate>
<turbo:content>
<turbo:content>
<![CDATA[
<header>
{set $img = $_pls['tv.model_image'] ? $_pls['tv.model_image'] : $_pls['tv.image']}
{set $site_url = $_modx->config.server_protocol ~ '://' ~ $_modx->config.http_host}
{if $img}
<figure>
<img src="{$site_url ~ $img | phpthumbon : "w=640&h=480&zc=1"}" />
</figure>
{/if}
<h1>{$pagetitle}</h1>
</header>
<description>
{'!Jevix' | snippet : [
'input' => $content
,'cfgAllowTags' => 'h1,h2,h3,a,br,hr,img,p'
,'cfgSetAutoLinkMode' => true
] | replace : 'src="' : ('src="' ~ $site_url ~ '/')}
</description>
]]>
</turbo:content>
</item>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment