Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Apr 2013 at 07:27 UTC
Updated:
6 May 2013 at 02:50 UTC
Hi,
I want to change meta description of search results page if there search query does not return any result, how I can do this?
Comments
Comment #1
damienmckennaYou would have to write some custom tokens that could (somehow) sniff the search results, and then add them to a per-path definition.
Comment #2
sharique commentedPath is same so we cannot use per path definition.
We are using custom search search service. We created a panel page to for search which contains custom search form and results ctools content type. Results pane take parameters from query string, send request to services and render results, here I need to check results count and alter meta description.
Comment #3
sharique commentedIf I can alter metatag context I can do that. Is there a way to alter context before getting hook_metatag_metatags_view_alter called?
Comment #4
damienmckennaThe by-path settings are just slightly customized Context definitions, and you could extend the by-path settings by using the main Context UI to add more conditions as needed - I believe there's a condition that will let you filter on the query string.
Comment #5
sharique commentedWe cannot identify no of results returned by looking at query parameters. Hence we cannot by path settings.
Comment #6
damienmckennaI'm not sure there's really a good way of doing this using Drupal's internal Search module, there isn't an obvious way to find out how many results there are without trying e.g. hook_preprocess_page to customize the meta tags based on the output of the page's content.
Comment #7
damienmckennaAlso, I'm sorry for not getting the point of your problem until now, but now that I understand what you're trying to do I do see it being tricky to work out.