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

    I’ve noticed that Modx automatically adds meta tag keywords and a script to the header of the pages, directly below the opening head tag.

    <script type="text/javascript">var MODX_MEDIA_PATH = "media";</script>
    <meta http-equiv="keywords" content="  ... etc / >


    Why does it add the script (what does it do?)? and how can I stop it adding the meta tag?

    Edit: Just found this page relating to the script.
      • 33337
      • 3,975 Posts
      resolving the thread.
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 25317
        • 122 Posts
        Quote from: zi at Nov 28, 2005, 12:17 PM

        resolving the thread.
        Not entirely... what about the automatically added meta keywords... how can I stop it being added?
          • 4095
          • 372 Posts
          I’m intrested in this too. I use the MetaTagExtra snippet which adds keywords. I have only just started to add keywords within MODx and noticed it adds <meta http-equiv="keywords"

          I know I can just remove keywords from the snippet to avoid duplications, but is there anyway to stop MODx adding them instead?
            [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
            Admin Sandbox Login: sandbox Password: castle
            • 33372
            • 1,611 Posts
            BUMP!

            I also want to remove this. I like my own META snippet better. Where is this code?

            Personally I think that this should be completely removed from MODx. One of the best things about MODx is that it gives you complete control over your output. This feature - although undoubtedly useful for some people - flies in the face of that idea.
              "Things are not what they appear to be; nor are they otherwise." - Buddha

              "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

              Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • ZAP, Briggsy, et al... I agree. Silly, really... should be a module or plugin.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 33372
                • 1,611 Posts
                I found the "offending" code in manager/includes/document.parser.class.inc.php. I just commented it out (see below). Alternatively you could alter it to meet your whims.

                	function mergeDocumentMETATags($template) {
                   /*
                		if($this->documentObject['haskeywords']==1) {
                			// insert keywords
                			$keywords = implode(", ",$this->getKeywords());
                			$metas = "\t<meta http-equiv=\"keywords\" content=\"$keywords\" />\n";
                		}
                		if($this->documentObject['hasmetatags']==1){
                			// insert meta tags
                			$tags = $this->getMETATags();
                			foreach ($tags as $n=>$col) {
                				$tag = strtolower($col['tag']);
                				$tagvalue = $col['tagvalue'];
                				$tagstyle = $col['http_equiv'] ? 'http_equiv':'name';
                				$metas.= "\t<meta $tagstyle=\"$tag\" content=\"$tagvalue\" />\n";
                			}
                		}
                		$template = preg_replace("/(<head>)/i", "\\1\n".$metas, $template);
                      */
                		return $template;
                	}

                I kind of like the idea of being able to add/alter meta tags from the document editor screen, but personally I would make it a snippet that interacts with the info entered there so that it’s easier to customize and streamline for efficiency.
                  "Things are not what they appear to be; nor are they otherwise." - Buddha

                  "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                  Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options