Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Can this module be used to add content data to the meta tags so that the tags are different on pages with different field data?
Comments
Comment #1
louisjimenez CreditAttribution: louisjimenez commentedHey,
I just added token replacement support and put out a new release, 7.x-1.4. Let me know if this is what you are looking for, thanks!
Comment #2
potassiumchloride CreditAttribution: potassiumchloride commentedWow. What a fast response! Thank you. This is a tremendously useful addition to the module. My initial testing indicates that it is working great. Field values are displaying in the custom meta tags that use tokens.
Notes/questions:
1. Load time
There is a very long load time for the "browse available tokens" which users should expect. In Firefox, it stalled the browser entirely. In Chrome, I was able to get Chrome to wait long enough to get the window to fully load.
If users know which tokens to insert, it is better to insert them manually than to wait for the browse window to load. Alternatively, it might be useful to open the "browse available tokens" in one web browser tab and to actually create the meta tags in another, rather than waiting for the token list to load for each meta tag creation.
2. Empty token values
Is there any way to have a sort of fallback option for those instances where there is no token data for a particular page? For example, most of the nodes on the site share fields, and the meta tags for those fields are working properly. For fields that are not on all nodes, the meta tag is there, but empty: content="".
3. HTML fields
If a field contains HTML, then that code is appearing in the meta content. For example, if I add the node body as
<meta name="Description" content="[node:body]">
, then I am getting this meta tag:<meta name="Description" content="<p>This is the body text.</p>">
4. fields from an entity reference
Is it possible to get field data for another entity via the entity reference? For example, I have content types A and B, and A references B. So, when I am on a node of type A, I would like to display a meta tag that contains field data from node B that is referenced via an entity reference. I can display B in the meta tags but I haven't been able to get any of the fields from B to display.
Again, thank you so much. This is going to be a big help for our use case.
Comment #3
potassiumchloride CreditAttribution: potassiumchloride commentedJust following up to see if you have any thoughts related to these questions. Thanks!
Comment #4
runzipel CreditAttribution: runzipel commentedIs this also planned for the 6.x version?