Download & Extend

node:nid token generates validation error (Context)

Project:Metatag
Version:7.x-1.0-beta2
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:active

Issue Summary

When I try to use this token...

[node:nid]

...I get validation errors like...

  • The Canonical URL is using the following invalid tokens: [node:nid].
  • The Shortlink URL is using the following invalid tokens: [node:nid].

I'm not sure if this is a metatag bug or a context module bug.

Comments

#1

Status:active» postponed (maintainer needs more info)

a) Are you using the latest version of Token.module?
b) Are you filling this in on a Metatag Context page, a normal Metatag settings page or an entity (e.g. node, term) edit page?

#2

Token 7.x-1.4

I've attached a screenshot showing the UI where this happens. It's in the Advanced fieldset at admin/config/search/metatags/context/story?destination=admin/config/search/metatags/context

Thanks

AttachmentSizeStatusTest resultOperations
node_nid_token.png69.19 KBIgnored: Check issue status.NoneNone

#3

I'm seeing the same error... is there any way to get the node tokens in scope having set/specified a node type for the context?

#4

Status:postponed (maintainer needs more info)» active

To replicate

Enable token 7.x-1.4, context 7.x-3.0-beta6, metatag 7.x-1.0-beta4 and metatag_context.

Create a new context.
Add a context condition "Node Type." Enable any or all content types.
Add a context reaction of "Meta Data."

Since this context is only active on nodes, we would expect that the [node:nid] token should be available for use in meta data. However, it results in the error described above.

I'm not familiar with the token module, but have traced flagging of the token as invalid to token_get_invalid_tokens_by_context().

It is unclear to me whether or not this is an issue with context, token or metatag.

#5

Hi,
I feel its not an issue about any module.There are already so many tokens for node which are available through module.
In "Canonical URL" field you should not give story/[node:nid] path.Its not a correct format. Choose that specific content(Story) from Node type section which you added in conditions section.
Select "Canonical URL" field and select tokens from "Browse available tokens" you will get node id in [node:nid] format and then save your context.

I hope it will work for you.

#6

Title:node:nid token generates validation error» node:nid token generates validation error (Context)

Clarifying this is a problem with the Context integration.

nobody click here