We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14653
    • 24 Posts
    As YAMS disable redirection for the snippet sitemap, when writing example.com/sitemap.xml passes for example.com/ru/sitemap.xml and and how to draw a conclusion at once for all languages in the document under the alias sitemap.xml to ru,en,ua?
      Sys. info:
      MODx version: MODx Revolution 2.x
      OS: Archlinux roller
      • 22851
      • 805 Posts
      jonimant. To achieve what you want - a single XML sitemap listing all documents in all languages, the sitemap needs to use a monolingual template, and you need to use the
      [[YAMS? &get=`repeat` &repeattpl=`SitemapRepeat`]]
      syntax.

      Here’s a comprehensive step by step guide - since they seem to be quite popular...

      Multilingual Sitemaps with YAMS

      This creates a single XML sitemap listing all documents in all languages. It assumes that all your web documents are multilingual. If you have monolingual web documents you need to be more clever in order not to include them in your sitemap multiple times.

      1. Create a new template called XMLSitemap

      2. Include the following in your XMLSitemap template:
      <?xml version="1.0" encoding="[(modx_charset)]" ?>
      <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" >
      [*content*]
      </urlset>
      


      3. Go to the Modules > YAMS > Multilingual Templates. Select "no" for XMLSitemap and submit.

      4. Create a new template variable.

      Name: UrlsetChangeFreq
      Caption: Change Frequency
      Description: Specify how often this page is likely to be updated. Be honest!
      Input type: DropDown List Menu
      Input option values: always||hourly||daily||weekly||monthly||yearly||never
      Default value: yearly
      (or monthly, or whatever)

      Associate the template variable with all your templates except XMLSitemap.

      5. Create another new template variable

      Name: UrlsetPriority
      Caption: Priority
      Description: If it is more/less important that google scans this page than other pages, give it a value higher/lower than 0.5. (Range 0...1)
      Input type: Number
      Input option values: (leave blank)
      Default value: 0.5

      Associate the template variable with all your templates except XMLSitemap.

      6. Create a new chunk called SitemapRepeatTpl with your ditto call in it that generates the <url> blocks for all your documents. Ideally, all your web documents should be in a single folder, and &parents should be set to the id of that folder. The snippet call might look something like this:
      [!Ditto? &language=`(yams_mname)` &parents=`1` &tpl=`UrlsetURL` &depth=`5` &dateSource=`editedon` &dateFormat=`%Y-%m-%d` &display=`all` &showInMenuOnly=`0` &seeThroughUnpub=`1` &filter=`type,reference,2|searchable,1,1`!]
      

      where UrlsetURL is another chunk with the following contents
      <url>
      <loc>(yams_doc:[+id+])</loc>
      <lastmod>[+date+]</lastmod>
      <changefreq>[+UrlsetChangeFreq+]</changefreq>
      <priority>[+UrlsetPriority+]</priority>
      </url>
      


      This ditto call specifies that there are maximum of 5 levels of folders - which can make the ditto call significantly more efficient in my experience, and excludes weblinks and un-searchable documents from the sitemap.

      7. Create a new document with the alias sitemap.xml that lives outside your web root folder. Select the XMLSitemap template. Set the content type to text/xml. For the content, use
      [[YAMS? &get=`repeat` &repeattpl=`SitemapRepeatTpl`]]
      


      Hey presto - multilingual XML Sitemap. In addition, you can specify the change frequency and priority via the template variables attached to each document.
        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.
        • 22851
        • 805 Posts
        Quote from: mgbowman at Aug 10, 2009, 03:28 AM

        Ok here’s v0.0.5
        Can’t wait to try it out now. Looks excellent...

        Quote from: mgbowman at Aug 10, 2009, 03:28 AM


        • I updated the code to more closely match that of YAMS core (to make migration easier) - the variable names are the same and I used wrapper functions so in my code there’s $this->IsMultilingualDocument(...) instead of $this->yams->IsMultilingualDocument(..)
        Great idea.

        Quote from: mgbowman at Aug 10, 2009, 03:28 AM


        • Regarding going from alias -> id I modified the algorithm according to your suggestions - grab the ’target’ alias and build the alias backwards, if it matches $q then we found what we’re looking for. The initial query looks at both resource alias and TV alias and loops over every match (just in case there’s multiple) - should I use something other than strcmp(..)?
        As I understand it, you are using strcmp rather than a direct string comparison because some users might be using Windows or might have set up their servers to allow case-insensitive URLs. Correct me if I’m wrong. I don’t think strcmp itself is multibyte safe - but I think you could do something like
        mb_strtolower( $stringA, $modx->config['modx_charset'] ) == mb_strtolower( $stringB, $modx->config['modx_charset'] )
        

        See http://us2.php.net/manual/en/function.mb-strtolower.php. This has been available since PHP 4 and YAMS only works with PHP 5 and onwards, so should be fine to use.

        Quote from: mgbowman at Aug 10, 2009, 03:28 AM

        Regarding if FURL alias paths are enabled, what do we do if they are disabled and there’s a ’/’ in $q? Do we simply look at the very first component and if we find a ’unique’ match (there could be multiples - 1 mono where alias=’foo’ & 1 multi where alias_en=’foo’) forward to the base resource? We could just abort altogether.
        I think that we should return and let MODx follow its default ’page not found’ behaviour. (In saying this, I am assuming that the virtual path that MODx builds is relative to the index.php file - even if MODx is installed into a subdirectory. I think so...)

        Quote from: mgbowman at Aug 10, 2009, 03:28 AM

        One more thought I had, what if FURLs are disabled altogether? Would we just return NULL for both GetDocumentAlias(..) and GetDocumentIdentifier(..)?
        I just had a play on one of my sites briefly. It appears that when FURLs are disabled, MODx will accept valid friendly aliases, but not friendly alias paths. I guess that we should do the same.
          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.
          • 14653
          • 24 Posts
          Quote from: PMS at Aug 10, 2009, 03:05 PM

          jonimant. To achieve what you want - a single XML sitemap listing all documents in all languages, the sitemap needs to use a monolingual template, and you need to use the
          [[YAMS? &get=`repeat` &repeattpl=`SitemapRepeat`]]
          syntax.

          Here’s a comprehensive step by step guide - since they seem to be quite popular...

          Multilingual Sitemaps with YAMS

          This creates a single XML sitemap listing all documents in all languages. It assumes that all your web documents are multilingual. If you have monolingual web documents you need to be more clever in order not to include them in your sitemap multiple times.

          Thanks to all the wonderful work

            Sys. info:
            MODx version: MODx Revolution 2.x
            OS: Archlinux roller
            • 30497
            • 245 Posts
            Hi PMS, Thanks for this wonderful work on YAMS - it is truly needed.

            I have just tried my first install of YAMS on a site in production. I believe I have set up everything according to instructions, but when I try to go to any "new" multi-lingual pages, I get 404 errors consistently. Also, the original pages of the site (already existed as monolingual) load, but all the content field loads empty - the page has no content at all apart from navigation and footer.

            I’ll explain my set up. first, here is my Language Settings configuration: You’ll notice that unlike most examples I have seen so far, I am not putting my default language in a virtual /lang/ directory, I rather English to be on the root.

            Could this be causing the issue? Of course, I have updated my .htaccess with your changes.

            I actually had to disable YAMS at the moment so someone could check the content of the site - but do you have any idea why I’d be getting 404 errors ? What can I do to make it easier to troubleshoot?


            BTW, I also have the problem mentioned earlier, where every lang tab has TVs for all languages - I am running your latest RC4, with MODx EVO 1.00 and the latest ManagerManager.
              • 22851
              • 805 Posts

              I have just tried my first install of YAMS on a site in production.
              Have you had this working on a non-production site?


              You’ll notice that unlike most examples I have seen so far, I am not putting my default language in a virtual /lang/ directory, I rather English to be on the root.
              Please can you show me a screen-shot of the top part of the same screen, with the monolingual settings and currently active mode?

              The set-up you are trying to use is not normally allowed. Each URL for each language must be unique. Currently your English URL probably conflicts with your monolingual URL. If you need to avoid the use of a root folder name for English, then I think you might be able to do that by explicitly specifying www.quitsmokingin10days.com as the server name for all the multilingual documents, and something like mono.www.quitsmokingin10days.com for your monolingual pages.


              but do you have any idea why I’d be getting 404 errors ?
              Not at the moment. I hope that it is because of a configuration error and not something else.

              With regards to the tabbed document view, have you edited your ManagerManager plugin to tell it to look in the mm_rules chunk? Have you placed the the YAMS ManagerManager rules in the mm_rules chunk?
                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.
                • 25483
                • 741 Posts
                I did just install YAMS + ManagerManager on a clean Evolution install, but the ManagerManager part is not working good.

                It does create the tabs for the languages, but it does not move the fields to these tabs! Does anyone else have this working?
                  with regards,

                  Ronald Lokers
                  'Front-end developer' @ h2o Media

                  • 22851
                  • 805 Posts
                  Does anyone else have this working?
                  I’ve seen this working on three sites other than my own now.

                  What version of ManagerManager are you using? Do you have any other non-YAMS rules? Make sure that your YAMS rules are the last ones to be specified. Try commenting out any non-YAMS rules - they might be interfering/overriding.
                    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.
                    • 25483
                    • 741 Posts
                    Quote from: PMS at Aug 11, 2009, 08:13 AM

                    Does anyone else have this working?
                    I’ve seen this working on three sites other than my own now.

                    What version of ManagerManager are you using? Do you have any other non-YAMS rules? Make sure that your YAMS rules are the last ones to be specified. Try commenting out any non-YAMS rules - they might be interfering/overriding.

                    It’s a clean site with no other settings, so the only rule in the mm_rules chunk is the call to the YAMS rules file. I did test it with these two: http://modxcms.com/extras/package/255 & http://modxcms.com/forums/index.php/topic,37985.0.html

                    Both give the same result, they make the tabs but they don’t move the fields to the tabs.
                      with regards,

                      Ronald Lokers
                      'Front-end developer' @ h2o Media

                      • 22851
                      • 805 Posts
                      Oh! I *might* know what it is! Try going to Modules > YAMS > Other Params
                      For the Document Layout setting, check that "Tabify TVs by Lang" is selected.
                      If that doesn’t work, let me know.
                        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.