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

    I thought I’d make things easy on my client, by having the meta-description deducted from the main content-field when it’s not filled. I used the following code:

    		<meta name="description" content="[[!If
    		?subject=`[[*description]]`
    		&operator=`!=`
    		&operand=``
    		&then=`[[*description]]`
    		&else=`[[*content:notags:strip:limit=`157`]]...`
    		]]" />
    


    However, in the page in question there’s a chunk in the page that calls getResources to create an overview. The output of getResources seems to just get rendered as HTML anyway (you can view the output at http://www.akto.nl/index2.php?id=10). Any thoughts? Is this a bug or am I doing something wrong?
      • 28554
      • 201 Posts
      Anyone? smiley
        • 32674
        • 101 Posts
        Just a guess w/o looking at your site’s genned html, but shouldn’t your "!If" function be surrounding the whole meta statement: (warning: aircode. Im sure my syntax has errors)

        [[!If?subject=`[[*description]]`&operator=`!=`&operand=``
        
          &then= <meta name="description" content="`[[*description]]`"
          &else=``
        
        ]]


        That way, the whole meta statement, including "meta tags" are removed, and not just the ’content’ attribute’s value. Again, only aircode, and I haven’t used "IF" and concating the "&then=" with the literal string ’<meta name="description" content="’ to the param ’`[[*description]]`’ is probably incorrect.

        But the idea of it should be correct-- "&else=" doesn’t need to output anything if there is no description value.
          • 28554
          • 201 Posts
          Quote from: wowzow at Jul 14, 2010, 07:39 AM

          Just a guess w/o looking at your site’s genned html, but shouldn’t your "!If" function be surrounding the whole meta statement: (warning: aircode. Im sure my syntax has errors)

          [[!If?subject=`[[*description]]`&operator=`!=`&operand=``
          
            &then= <meta name="description" content="`[[*description]]`"
            &else=``
          
          ]]


          That way, the whole meta statement, including "meta tags" are removed, and not just the ’content’ attribute’s value. Again, only aircode, and I haven’t used "IF" and concating the "&then=" with the literal string ’<meta name="description" content="’ to the param ’`[[*description]]`’ is probably incorrect.

          But the idea of it should be correct-- "&else=" doesn’t need to output anything if there is no description value.

          That’s not what I meant to do. I want the statement to look if [[*description]] is filled. If it is, I want it to dump the content of [[*description]] there, and if it isn’t i want it to take the field [[*content]], strip all html-tags etc. from it, cut it off at 157 characters, and place that in the description. It works, except for when I call getResources in [[*content]]. If I do, it takes the part of the content before the getResources call, strips all HTML out, and then just dumps the entire getResources output in there. Which is rather undesirable (HTML-tags etc. in my meta-description). I want it to pars the entire [[*content]], including the getResources call, and then strip and limit it, not have it strip and limit it and then add the getResources call...
            • 22303 MODX Staff
            • 10,725 Posts
            First of all, doing that on every request would not be practical. IMO, you need a plugin that automatically fills your description on Save in the manager.

            Second, you would need to write a Snippet to do what you want, by forcing the content to be processed including non-cacheable tags, before returning any output. What is happening is that getResources being called uncached is not being processed until the next pass of the parser, thus after the filtering. You would basically need to implement some of the functionality in modResponse::outputContent().
              • 32674
              • 101 Posts
              As an aside thought to what you’re trying to do:


              I’d still just drop the whole meta tag if the description was missing, per this:
              http://googlewebmastercentral.blogspot.com/2009/09/google-does-not-use-keywords-meta-tag.html

              I used to maintain metas on a adsense driven website that was #1 on google, yahoo, and bing (msn at the time) search engines for a pretty popular word. (granted not a super competitive seo nitch - only 3 million or so google included pages. for comparison, ’modx’, is about a 1 million page search nitch)...

              ...but eventually I got really lazy in my article writing and editing, and dropped all the meta tags (keywords + description) I was maintaining. The rankings for yahoo and bing never dropped.

              So in my experience, I seriously think meta tags are ’mostly irrelevant’ as of a few years ago. Really a waste of time, unless youre planning to use the tags for your own site searches, or for dublin core searching (different tags though). They really are totally safe to just drop. (Granted I haven’t done much hard core, daily SEO tracking in the last few years, but I doubt any of the SE’s place much importance on that meta tag than they did back then as it’s MUCH abused.

              Please don’t take my word for this, have a look at what the #1 ranked sites are doing. Here’s a few I just grabbed seconds ago on a super competitive word ’seo’---- Top 5 listed sites for "seo" at Bing.com:
              ---> http://www.bing.com/search?q=seo

              (a mere 200 million page nitch (google) or 17 million (bing) or 1.3 billion page nitch! (yahoo). Any way you dice it, it’s a highly competitive term, as all of the sites/pages were designed by SEO practitioners. duh. grin):

              None of the top 5 listed have a single meta tag for ’description’ or ’keywords’ in them.

              • #1 wikipedia.com - nope
              • #2 seo.com - nope
              • #3 wikipedia.com (again)- nope
              • #4 seo-usa.org- nope
              • #5 seochat.com- nope


              So there you have it. A search engine that claims meta tags are important*, yet, for a super competitive search term-- not a single meta tag for ’description’ or ’keywords’ to be found in the top 5 sites in it’s results.
              *ref: http://www.bing.com/toolbox/posts/archive/2009/12/01/seo-and-sem-basics.aspx
                • 28554
                • 201 Posts
                Quote from: wowzow at Jul 14, 2010, 02:14 PM

                As an aside thought to what you’re trying to do:


                I’d still just drop the whole meta tag if the description was missing, per this:
                http://googlewebmastercentral.blogspot.com/2009/09/google-does-not-use-keywords-meta-tag.html

                I used to maintain metas on a adsense driven website that was #1 on google, yahoo, and bing (msn at the time) search engines for a pretty popular word. (granted not a super competitive seo nitch - only 3 million or so google included pages. for comparison, ’modx’, is about a 1 million page search nitch)...

                ...but eventually I got really lazy in my article writing and editing, and dropped all the meta tags (keywords + description) I was maintaining. The rankings for yahoo and bing never dropped.

                So in my experience, I seriously think meta tags are ’mostly irrelevant’ as of a few years ago. Really a waste of time, unless youre planning to use the tags for your own site searches, or for dublin core searching (different tags though). They really are totally safe to just drop. (Granted I haven’t done much hard core, daily SEO tracking in the last few years, but I doubt any of the SE’s place much importance on that meta tag than they did back then as it’s MUCH abused.

                Please don’t take my word for this, have a look at what the #1 ranked sites are doing. Here’s a few I just grabbed seconds ago on a super competitive word ’seo’---- Top 5 listed sites for "seo" at Bing.com:
                ---> http://www.bing.com/search?q=seo

                (a mere 200 million page nitch (google) or 17 million (bing) or 1.3 billion page nitch! (yahoo). Any way you dice it, it’s a highly competitive term, as all of the sites/pages were designed by SEO practitioners. duh. grin):

                None of the top 5 listed have a single meta tag for ’description’ or ’keywords’ in them.

                • #1 wikipedia.com - nope
                • #2 seo.com - nope
                • #3 wikipedia.com (again)- nope
                • #4 seo-usa.org- nope
                • #5 seochat.com- nope


                So there you have it. A search engine that claims meta tags are important*, yet, for a super competitive search term-- not a single meta tag for ’description’ or ’keywords’ to be found in the top 5 sites in it’s results.
                *ref: http://www.bing.com/toolbox/posts/archive/2009/12/01/seo-and-sem-basics.aspx

                While I agree with you on the keywords-part, Meta-description is a way to control the second part of your organic results: what’s in the description comes below the page-title most of the time (I’m not gonna go into detail here, that’s a discussion for a different forum), and moreover at least 3 out of 5 of the sites you just mentioned do in fact have a meta-description.

                Nevertheless, what I’m trying to achieve should be possible, shouldn’t it? Parse the entire content, then apply the output-filters to them, right?
                  • 32674
                  • 101 Posts
                  Quote from: StevenLangbroek at Jul 14, 2010, 03:37 PM

                  While I agree with you on the keywords-part, Meta-description is a way to control the second part of your organic results: what’s in the description comes below the page-title most of the time (I’m not gonna go into detail here, that’s a discussion for a different forum)...
                  Definitely true, that.

                  Quote from: StevenLangbroek at Jul 14, 2010, 03:37 PM
                  ...and moreover at least 3 out of 5 of the sites you just mentioned do in fact have a meta-description.
                  you are SO correct. I was lazy and just looked at the sites’ source pages in Firefox ’page source’. Flipping on firebug and taking a look see and they appear. DOH! Thanks for correcting me on it.

                  Few years back most of the top 10 for ’seo’ didnt have them. That’s when I removed mine, also on recommedation from a few at webmasterworld.

                  Quote from: StevenLangbroek at Jul 14, 2010, 03:37 PM

                  Nevertheless, what I’m trying to achieve should be possible, shouldn’t it? Parse the entire content, then apply the output-filters to them, right?

                  Certainly should be easy. Ive been no help whatsover, and haven’t used "IF". so I’ll just stfu for now. smiley Bummer Holland didn’t win, though. sad
                    • 28554
                    • 201 Posts
                    Quote from: wowzow at Jul 14, 2010, 09:32 PM

                    Quote from: StevenLangbroek at Jul 14, 2010, 03:37 PM

                    While I agree with you on the keywords-part, Meta-description is a way to control the second part of your organic results: what’s in the description comes below the page-title most of the time (I’m not gonna go into detail here, that’s a discussion for a different forum)...
                    Definitely true, that.

                    Quote from: StevenLangbroek at Jul 14, 2010, 03:37 PM
                    ...and moreover at least 3 out of 5 of the sites you just mentioned do in fact have a meta-description.
                    you are SO correct. I was lazy and just looked at the sites’ source pages in Firefox ’page source’. Flipping on firebug and taking a look see and they appear. DOH! Thanks for correcting me on it.

                    Few years back most of the top 10 for ’seo’ didnt have them. That’s when I removed mine, also on recommedation from a few at webmasterworld.

                    Quote from: StevenLangbroek at Jul 14, 2010, 03:37 PM

                    Nevertheless, what I’m trying to achieve should be possible, shouldn’t it? Parse the entire content, then apply the output-filters to them, right?

                    Certainly should be easy. Ive been no help whatsover, and haven’t used "IF". so I’ll just stfu for now. smiley Bummer Holland didn’t win, though. sad


                    Yeah tell me ’bout it. We played a dirty match but that f**ing ref made 2 critical calls that cost us the match and the cup. Aaannyyhoo, back to the issue on hand: any of the devs: is this the proper parsing order? I somehow feel like this is a bug, and that the entire content should be parsed before it should be ran through the output-filters...
                      • 28554
                      • 201 Posts
                      Anyone?