*

questions

  • *****
  • 319 posts
Possible to add meta description to cities?
« on: April 19, 2023, 02:27:42 PM »
Hi,

I am wondering if it is possible to add meta description to cities too. To regions it is possible with All in One SEO Plugin, but to cities not. So is there any function that generates meta description to cities too?

For example Free classifieds in "City name". Buy and sell items in "City name". Free classifieds near your city: "City name".

Is it possible to do this when searching and filtering by city?
Thank you,

*

MB Themes

Re: Possible to add meta description to cities?
« Reply #1 on: April 19, 2023, 03:00:29 PM »
Currently not in plan, there is too many cities so it does not make sense to define it on city level.
Better function will have to be provided.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

questions

  • *****
  • 319 posts
Re: Possible to add meta description to cities?
« Reply #2 on: April 19, 2023, 04:00:10 PM »
Currently not in plan, there is too many cities so it does not make sense to define it on city level.
Better function will have to be provided.

I could give up on All in one SEO plugin using the function below, but can't manage to make it perfect.

I have created this a bit earlier, but still can't manage to make it as I want...

I only want this function to create my text .. only for cities... I would like to make this function  know when meta description is generated by ALL IN ONE SEO PLUGIN, and only generate the words when ALL IN ONE SEO PLUGIN don't generated for cities for example.

Can you help modify it please?

<?php
if(meta_description() != '') {
  $city = osc_search_city();
  $search_pattern = osc_search_pattern();
  $meta_desc = "";
  if (!empty($search_pattern) && !empty($city)) {
    // Search by keyword and city
    $meta_desc = "Looking for ".$search_pattern." in " . ucfirst(strtolower($city)) . "? ";
  } elseif (!empty($search_pattern)) {
    // Search by keyword only
    $meta_desc = "Looking for Free Classifieds with ".$search_pattern."? ";
  } elseif (!empty($city)) {
    // Search by city only
    $meta_desc = "Looking for Free Classifieds in " . ucfirst(strtolower($city)) . "? ";
  }
  if (!empty($meta_desc)) {
    $meta_desc .= "Find Free Classifieds";
    if (!empty($search_pattern)) {
      $meta_desc .= " with ".$search_pattern;
    }
    if (!empty($city)) {
      $meta_desc .= " in " . ucfirst(strtolower($city));
    }
    $meta_desc .= ". Free Classifieds";
    if (!empty($search_pattern)) {
      $meta_desc .= " with ".$search_pattern;
    }
    if (!empty($city)) {
      $meta_desc .= " in " . ucfirst(strtolower($city));
    }
    $meta_desc .= ", recently added.";
  }
?>
  <meta name="description" content="<?php echo osc_esc_html($meta_desc); ?>" />
<?php
}
?>

*

questions

  • *****
  • 319 posts
Re: Possible to add meta description to cities?
« Reply #3 on: April 19, 2023, 04:16:24 PM »
Maybe a function in all in one seo plugin like this... which can be enabled or disabled.

Looking for "PRODUCT_LABEL" in "CATEGORY_LABEL" in "CITY_LABEL/REGION_LABEL". Find...  for "PRODUCT_LABEL" in "CATEGORY_LABEL" in "CITY_LABEL/REGION_LABEL".

If enabled to apply if disabled to not.. is it possible something like this? or can be custom work at least?

Not necessary for all in one seo plugin... but for meta description in head.php.