We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25260
    • 156 Posts
    Hi,

    how can I set target="_blank" to the YAMSified weblinks (i.e., with the URL written in the multilingual content)?

    I’m taking a look at the source code of the YAMS class, but it’s quite big, and any hints will be greatly appreciated :-D

    Cheers,

    Roberto
      • 22851
      • 805 Posts
      I’m not entirely sure what you mean... The following will create a link to a weblink with target="_blank": [tt]<a href="[~weblinkId~]" target="_blank">link text</a>[/tt]

      If you want YAMS to resolve all weblinks to the destination then you can set: [tt]Modules>YAMS>Other Params>URL formatting>URL Conversion Mode=Resolve[/tt]

      You can override the default behaviour for individual weblinks:
      [tt]<a href="(yams_doc:weblinkId)" target="_blank">link text</a>[/tt] will display the weblink URL
      [tt]<a href="(yams_docr:weblinkId)" target="_blank">link text</a>[/tt] will display the weblink destination URL.

      Hope that helps.
        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.
        • 25260
        • 156 Posts
        I just want to set target="_blank" to a weblink, like I do when I have a monolingual weblink :-D
        I generate them with Wayfinder for displaying in our site, and not all the weblinks must go in _blank, so I can’t put your solution in the weblink tpl of Wayfinder.
          • 22851
          • 805 Posts
          For info: YAMS Wayfinder documentation

          I see. You want to use the "link attributes" field in a Wayfinder template. This is normally done via the [tt][+wf.attributes+][/tt] placeholder. I can’t see any reason why this wont work like normal. The link attributes field is not multilingual and should be parsed like normal by the Wayfinder snippet.

          A standard YAMS-ified Wayfinder snippet call looks like:

          [tt][[Wayfinder? other args... &rowTpl=`@FILE:assets/modules/yams/tpl/wayfinder/docr/row.tpl`]][/tt]

          where the contents of the row.tpl file are

          <li[+wf.id+][+wf.classes+]>
            <a href="(yams_docr:[+wf.docid+])" title="[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`pagetitle`]]" [+wf.attributes+]>[[YAMS? &get=`data` &docid=`[+wf.docid+]` &from=`menutitle`]]</a>
            [+wf.wrapper+]
          </li>


          So the default YAMS templates already include the [tt][+wf.attributes+][/tt] placeholder. Are you using the default YAMS Wayfinder templates or your own customised ones?
            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.
            • 25260
            • 156 Posts
            I was just using custom templates and I missed [+wf.attributes+] :-D

            Thanks :-D