There needs to be a way to ignore the front page meta tags and instead use tags loaded e.g. via an entity.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Peacog’s picture

I have found the handling of front page metatags very confusing, and I when I came across this issue I finally began to understand. For me this feature is very important. Here's my understanding of Global node and Global front page metatags. Please correct me if I'm wrong.

Global Node metatags are default metatags that can be overridden by setting them directly in the node.
The Global: Front page metatags are NOT default metatags and cannot be overridden by setting them in the node (assuming your front page is a node). If you're using a node for your front page, any metatags you set in the node will never be used. If you disable the Global: Front page metatags the system reverts to using Global metatags. If you disable Global metatags, you will get no metatags at all on your front page.

I can think of two situations where it is desirable to ignore the Global metatags and load the tags from the node. The first is in a multilingual website where you have a different front page node for each language. There's a patch (http://drupal.org/node/1282620#comment-6858710) that looks like it will get around that problem by allowing you to translate Global metatags. I've reworked the patch a little so it needs to be reviewed and tested, but it works for me.

The second situation is in a multiple domain site that uses Domain Access, where you have a different front page node for each domain. Currently there does not seem to be any way to set different front page metatags for different domains. There is work ongoing on Domain Meta Tags (see issue here http://drupal.org/node/1399724) but that module is not ready yet.

I hope that's an accurate summary of the situation, and I hope it helps clarify things for anyone who's as confused as I was. Adding the option to ignore Global front page tags, either by just disabling them or by a checkbox setting, would mean that in my case I wouldn't need the multilingual metatags patch or the Domain Meta Tags module.

plach’s picture

Status: Active » Needs review
FileSize
732 bytes

What about this?

Peacog’s picture

Thank you! That works perfectly and solves both the multilingual and multiple domains problem in one neat solution.

DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, a very simple solution, thanks plach!

Once #1798294: Can't edit non-current node revisions is resolved I'll commit this.

Dave Reid’s picture

I think this might error if the front page configuration is deleted somehow or doesn't return an object, which could be a valid result.

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs work

@Dave: Good catch.

plach’s picture

Status: Needs work » Needs review
FileSize
1.29 KB

Better?

aendra’s picture

I can confirm the patch in #7 applies cleanly against 7.x-1.x-dev and resolves the issue. Haven't tried it against the test case in #5.

Dave Reid’s picture

I think it would just be easier to have a helper function for determining if an instance is enabled since we have to do some of this same logic elsewhere.

Status: Needs review » Needs work

The last submitted patch, 1814736-metatag-check-if-frontpage-disabled.patch, failed testing.

Dave Reid’s picture

Status: Needs work » Needs review
FileSize
2.44 KB

Try that again.

Dave Reid’s picture

Status: Needs review » Fixed

Tests pass so committing #11 to 7.x-1.x.
http://drupalcode.org/project/metatag.git/commit/140a324

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.