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

    Is there a way to set custom meta tags for keywords and description, in PHP code, not in using manager ...

    Thanks for your support.
      • 6726
      • 7,075 Posts
      What do you mean by "custom" and "not using manager" ?

      As you apparently know, you can set meta keywords and description in the manager indeed.

      But of course with MODx you could also use a chunk or TV for each page for instance, just need to insert this into your template and you’re set. One way to do this if you use tags with Ditto is to add you tag chunk in meta keywords...

        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 25663 MODX Staff
        • 12,272 Posts
        The default [*description*] could easily be used for keywords, and [*introtext*] (summary) could be a handy spot for meta-description (since it’s a slightly large field).

        Then in your template:
        	<meta name="description" content="[*introtext*]" />
        	<meta name="keywords" content="[*description*]" />


        (Bugs me that the document objects are named that way in this instance, but from a workflow and usability standpoint i think it makes more sense. Need to be careful about the field limits for both which i don’t recall off the top of my head... If they’re too short, create a [*meta-desc*] and a [*meta-kwd*] TV...)
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me