We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    I already have xml feeds working according to instructions in the original monster YAMS thread. I tried applying (what I thought was...) the same logic to creating rss feeds, with no success yet.

    I need a separate feed per language.

    Has anyone achieved this yet?

    thanks.
      • 22851
      • 805 Posts
      You mean like demonstrated on this website?

      This is one way to do it:

      1. Create a new template called RSS. Use a variant of the following code:
      <?xml version="1.0" encoding="[(modx_charset)]" ?>
      <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xml:lang="(yams_tag)">
      <channel>
      <atom:link href="(yams_doc:[*id*])" rel="self" type="application/rss+xml" />
      <title>[*pagetitle*]</title>
      <link>(yams_site:[*id*])</link>
      <description>[*introtext*]</description>
      <language>(yams_tag)</language>
      <copyright>Copyright ..., 2009</copyright>
      <docs>http://www.rssboard.org/rss-specification</docs>
      <ttl>1440</ttl>
      <image>
      <url>[(site_url)]assets/images/...</url>
      <title>[*pagetitle*]</title>
      <link>(yams_site:[*id*])</link>
      <width>...</width>
      <height>...</height>
      </image>
      [*content*]
      </channel>
      </rss>
      

      Replace occurrences of ... with your
      - copyright, and
      - image location and dimensions where appropriate. (Alternatively, leave out the image block.)

      2. Go to Modules > YAMS > Multilingual Templates, specify the newly created RSS template as multilingual and select Update.

      3. Create a chunk called RSS_item with something like the following content:
      <item>
      <title><![CDATA[ [+longtitle+] ]]></title>
      <link>(yams_doc:[+id+])</link>
      <description><![CDATA[ [+introtext+] ]]></description>
      <pubDate><![CDATA[ [+date+] ]]></pubDate>
      <guid isPermaLink="true">(yams_doc:[+id+])</guid>
      </item>
      


      3. Create a new document.
      - Change the template to RSS.
      - Give it an appropriate alias (or aliases) - myfeed.rss, for example.
      - Make it cacheable
      - Set the content type to application/rss+xml
      - In each of the content fields for each language, place the following ditto call:
      [!Ditto? &parents=`...` &language=`(yams_mname)` &tpl=`RSS_item` &depth=`1` &dateSource=`editedon` &dateFormat=`%a, %d %b %Y %H:%M:%S GMT` &display=`all` &showInMenuOnly=`0` &seeThruUnpub=`0` &filter=`type,reference,2|searchable,1,1` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`!]
      

      where ... should be replaced by the folder containing the feed documents. The ditto call will search one level deep and the filter ensures that only non-weblink documents that are searchable are included. (You can change this if you like.)
      - Publish it.
        YAMS: Yet Another Multilingual Solution for MODx
        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • 30497
        • 245 Posts
        Quote from: PMS at Nov 03, 2009, 05:52 PM

        You mean like demonstrated on this website?

        This is one way to do it:

        1. Create a new template called RSS. Use a variant of the following code:
        <?xml version="1.0" encoding="[(modx_charset)]" ?>
        <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xml:lang="(yams_tag)">
        <channel>
        <atom:link href="(yams_doc:[*id*])" rel="self" type="application/rss+xml" />
        <title>[*pagetitle*]</title>
        <link>(yams_site:[*id*])</link>
        <description>[*introtext*]</description>
        <language>(yams_tag)</language>
        <copyright>Copyright ..., 2009</copyright>
        <docs>http://www.rssboard.org/rss-specification</docs>
        <ttl>1440</ttl>
        <image>
        <url>[(site_url)]assets/images/...</url>
        <title>[*pagetitle*]</title>
        <link>(yams_site:[*id*])</link>
        <width>...</width>
        <height>...</height>
        </image>
        [*content*]
        </channel>
        </rss>
        

        Replace occurrences of ... with your
        - copyright, and
        - image location and dimensions where appropriate. (Alternatively, leave out the image block.)

        2. Go to Modules > YAMS > Multilingual Templates, specify the newly created RSS template as multilingual and select Update.

        3. Create a chunk called RSS_item with something like the following content:
        <item>
        <title><![CDATA[ [+longtitle+] ]]></title>
        <link>(yams_doc:[+id+])</link>
        <description><![CDATA[ [+introtext+] ]]></description>
        <pubDate><![CDATA[ [+date+] ]]></pubDate>
        <guid isPermaLink="true">(yams_doc:[+id+])</guid>
        </item>
        


        3. Create a new document.
        - Change the template to RSS.
        - Give it an appropriate alias (or aliases) - myfeed.rss, for example.
        - Make it cacheable
        - Set the content type to application/rss+xml
        - In each of the content fields for each language, place the following ditto call:
        [!Ditto? &parents=`...` &language=`(yams_mname)` &tpl=`RSS_item` &depth=`1` &dateSource=`editedon` &dateFormat=`%a, %d %b %Y %H:%M:%S GMT` &display=`all` &showInMenuOnly=`0` &seeThruUnpub=`0` &filter=`type,reference,2|searchable,1,1` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`!]
        

        where ... should be replaced by the folder containing the feed documents. The ditto call will search one level deep and the filter ensures that only non-weblink documents that are searchable are included. (You can change this if you like.)
        - Publish it.

        Oh great Paul, thanks. It works really well.

        My client’s site is totally finished now, if you want to add it to your list of Powered by YAMS sites:
        http://www.quitsmokingin10days.com/
        http://es.quitsmokingin10days.com/
        http://ru.quitsmokingin10days.com/
          • 6848
          • 52 Posts
          Hi,
          Some variation on the solution:

          1. Create "empty" multilingual template - put only [*content*] in the template
          2. create the chunk to use in the ditto call. probably the chunk above would do the job, mine looks a bit different:
          <item>
          		<title>[+pagetitle+]</title>
          		<link>[(site_url)](yams_id)/[~[+id+]~]</link>
          		<description><![CDATA[ [+introtext+] ]]></description>
          		<pubDate>[+rss_date+]</pubDate>
          		<guid isPermaLink="false">[(site_url)](yams_id)/[~[+id+]~]</guid>
          </item>
          


          the usage of ditto rss format (see below) and [+rss_date+] placeholder simplifies the formatting

          3. Use ditto call like this:

          [!Ditto? &id=`(yams_id)_rss` &parents=`4` &language=`(yams_mname)` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` &format=`rss` &total=`100` &tpl=`rss_item.dt` &filter=`available_(yams_id),1,1`  &hideFolders=`1` &dateSource=`pub_date` &orderBy=`pub_date DESC`!]
          


          This variant uses the build in ditto rss formatter (see &format=`rss` in the call) and simplifies the formating of the xml.
            • 22851
            • 805 Posts
            Hi @ddim.

            You are clearly rapidly becoming a YAMS expert. Thank you once again for taking the time to share your solutions with the rest of the YAMS community. It’s much appreciated.

            Please note that the way you have constructed your URLs in the solution above

            [tt][(site_url)](yams_id)/[~[+id+]~][/tt]

            is specific to your particular language set-up. It won’t work for everyone and it will break your site if you every decide to change your language settings at a later date. For that reason I recommend using

            [tt](yams_doc:[+id+])[/tt]

            instead. This YAMS placeholder is generic and will always output the correct URL for the correct language, no matter what the language settings are.
              YAMS: Yet Another Multilingual Solution for MODx
              YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
              Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
              • 6848
              • 52 Posts
              Thank you smiley
              When your native language is not English you have to be an expert in multilingual solutions smiley

              About the chunk, I saw this after I posted it, and changed it in the real implementation, but didn’t change in the post.
                • 25260
                • 156 Posts
                Hi PMS,

                I’m using your solution, for a bilingual site (italian/english, having italian as default language).

                I have a problem: italian feeds works well, whereas english feeds aren’t displaying [+date+].

                Do you have any ideas?

                Cheers,

                Roberto
                  • 25260
                  • 156 Posts
                  Actually that’s working with ddim solution :-D