0

I am using seo lite and it works fine with tag {extra:desc}.

But when I write in the seolite description in the template, it over writes the title and keywords but not the description. It overwrites if I dont use the tag {extra:desc}.

Can you please help me with this.

this is ma code ---

{if "{extra:desc}" !="" }

   <meta name='keywords' content='{meta_keywords}' />
  <link rel='canonical' href='{canonical_url}' />
  <meta name="google-site-verification" content="CGYXJx34stuBq6Ahar-eFmhCJL-egrm533wopJONBoY" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta name="author" content="but.ae"/>
  <meta name='description' content="{exp:streeng characters="160" find="WHAT IS IT" replace=" "}{extra:desc}{/exp:streeng}" />

 <

 <title>{title}</title>

{if:else}

  <meta name='keywords' content='{meta_keywords}' />
  <link rel='canonical' href='{canonical_url}' />
  <meta name="google-site-verification" content="CGYXJx34stuBq6Ahar-eFmhCJL-egrm533wopJONBoY" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta name="author" content="but.ae"/>
  <meta name='description' content="{meta_description}" />


 <title>The Future Build</title>
{/if}

Hope to hear from you soon.

2 Answers 2

2

For anyone interested the user was helped over here:

https://getsatisfaction.com/addonbakery/topics/seo-lite-extra-desc-not-over-riding

1

I found that I wanted my meta description to be populated with the following priority:

  • Custom SEO Description in entry edit SEO Lite tab
  • Extracted {extra:desc} value from my entry
  • Fallback site-wide Default description set in SEO Lite settings

I couldn't find a way to do this with SEO Lite as it stands, so I decide to add a new variables that I could use in my SEO Lite template, {default_description}, which contains the SEO Lite default description. That way, I can compare to see if my {meta_description} is equal to that, and if so, use my fallback {extra:desc}.

I added the following code to mod.seo_lite.php

$vars[$this->tag_prefix.'default_description'] = htmlspecialchars($seolite_entry->default_description, ENT_QUOTES);

And in my SEO Lite Template, I have the following:

<meta property="default_description" content="{default_description}" />
{if meta_description == default_description && extra:desc != ' ...'}
    <meta property="og:description" content="{extra:desc}" />
    <meta name='description' content='{extra:desc}' />
    <meta name="twitter:description" content="{extra:desc}">
{if:else}
    <meta property="og:description" content="{meta_description}" />
    <meta name='description' content='{meta_description}' />
    <meta name="twitter:description" content="{meta_description}">
{/if}

Now, if I have set a SEO Description in my entry, that will be output. Otherwise, if {extra:desc} has a value, that will be used. And if neither of those is set, it uses my default site-wide description.

Hope this helps someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.