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.

Files: 
CommentFileSizeAuthor
#2 node_nid_token.png69.19 KBarnoldbird

Comments

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?

StatusFileSize
new69.19 KB

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

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?

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.

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.

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

Clarifying this is a problem with the Context integration.

Marked two issues as duplicates:

Lets focus on either removing the incompatible tokens from the token browser, or fix the token processing.

I'd like to have this fixed (by supporting node tokens when you have a node type context), but I never worked with context: have you any hint about what to do? (I'm willing to dig into the problem and try to produce a patch, but maybe you have some suggestions for me before I start doing this.)

Version:7.x-1.0-beta2» 7.x-1.x-dev
Component:Code» Context

[node:*] tokens are not working for me with Context.

Component:Context» User interface
Issue summary:View changes
Issue tags:+APC

This could be an issue by php apc. I fixed the issue by flushing the cache and disabling apc.

Component:User interface» Code

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

That you had to disable APC makes no sense, though needing to flush its cache may have been necessary depending on its configuration.

No Damien. APC is right cause with my case. I flushed caches several times and nothing happened until I disabled APC in settings.php, the module and flushed caches again.

Ref settings.php:

// Varnish
$conf['cache_backends'][] = 'sites/all/modules/performance/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
// Drupal 7 does not cache pages when we invoke hooks during bootstrap.
// This needs to be disabled.
$conf['page_cache_invoke_hooks'] = FALSE;
//memcache
$conf['cache_backends'][] = 'sites/all/modules/performance/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array(
  '127.0.0.1:11211' => 'default'
);
$conf['memcache_key_prefix'] = 'xxx';
// APC
/*$conf['cache_backends'][] = 'sites/all/modules/performance/apc/drupal_apc_cache.inc';
$conf['cache_class_cache'] = 'DrupalAPCCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalAPCCache';
$conf['cache_prefix'] = 'inlook';
*/

Oh, the module, I never use it so I forgot about it.

Is there any benefit to using APC and memcache rather than just memcache?

Does the problem persist if you disable the 'cache_class_cache' line, i.e. only use APC for the bootstrap?

There are some stages of caching that I need to use both in my site.
APC to run the the PHP opcode and Memcache to check if data is generated in Drupal.

The site is production so I can't take the risk to turn on apc back.
I will spend sometime to reproduce the issue in my dev.