Add support for custom meta tags

Created on 23 November 2022, about 2 years ago
Updated 15 September 2023, over 1 year ago

Problem/Motivation

You might be wondering, what I'm talking about and YES, there's the Metatag module and I love it! ;)

Still in the past for Drupal 7 there was the tracking_code β†’ module to add meta tracking codes like for Google Search Console (aka. Webmaster Tools).

While the Metatag module also supports the most typical cases, Asset Injector might be helpful for custom cases and adding support to add meta support would make it complete besides supporting CSS link and JS script.

The architecture of the Asset Injector module is already prepared for further types, so this might be really handy to add.

Still I think this is minor and as long as there's no huge feedback for the need and nobody starts implementing it (for fun or a good reason), we should just ensure the maintainers are okay with that additional feature.

https://www.drupal.org/project/tracking_code β†’ already links Asset Injector as follow-up solution, but for meta tags it's no replacement yet.

Steps to reproduce

Proposed resolution

Remaining tasks

  1. Discuss
  2. Implement
  3. Test
  4. Release

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Note to myself: Would once again be helpful as full replacement for https://www.drupal.org/project/tracking_code β†’ to add validation snippets (which are not supported by Metatags module) to the head!

  • πŸ‡ΊπŸ‡ΈUnited States pookmish

    Would something like Custom Meta β†’ satisfy that request? Seems to fit the request to me.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @pookmish indeed that looks good for such cases!

    Would you still be fine with integrating similar functionality into asset_injector (if the community / we implement it) or do you think it's totally different from that asset_injector is supposed to do?

    I think it's still quite similar and could be helpful to have these three features in one module instead of having to use separate modules... but I'll also think about it again. Just would like to have your opinion here and know if there's a chance to integrate it anyway.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @pookmisch would you be fine to add this function to have all these three options combined in this module? I'd really love that instead of having to use one further module for something very similar. Furthermore asset_injector already has settings / options to select conditions where this should be added.

    Of course, we'd prepare the code.

    The plan would be to add a third inject type for meta. Similar to how custom_meta β†’ solves it (see screenshot β†’ ) you could then select the attribute and its content. Eventually we should allow multiple instead of just one?

    So I think there would even be some more features out of the box in comparison to custom_meta, but having one module for these three related things is also a good thing from my perspective.

    Technical reference:
    https://drupal.stackexchange.com/questions/217880/how-do-i-add-a-meta-ta...

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @pookmish would you accept if we added this? I wouldn't like to invest time (& money) here for something that won't get merged. Still, I would like to invest time (& money) for a feature that I think would be great to have included (see previous comments).

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @pookmish re #3 I just ran into another case of a "metatag" that should be added in UI and the custom_meta module isn't able to handle, while it would be great to use asset_injector as swiss-army knife:

    Adding <link rel="alternate" type="application/rss+xml" href="https://example.com/technology/feed/" /> doesn't seem possible (background: RSS link https://developers.google.com/search/docs/appearance/google-discover?hl=de)

    So if you could green-light for merging such a feature, may it be included directly or as submodule, that would be fabulous!

Production build 0.71.5 2024