- Issue created by @naveenvalecha
- 🇩🇪Germany Anybody Porta Westfalica
Just came across this and I think it would indeed make sense to integrate "Custom Metatags" ( https://www.drupal.org/project/custom_meta → ) as a submodule. But it should then better fit the UX from Metatags.
While Metatag perfectly supports all standard meta tags, you sometimes run into situations, where you need to add futher custom meta tags, for example for Domain Owner Validation and other cases which don't make sense to handle by adding these meta tags statically in Metatags.
The main benefit if having custom_meta as submodule in Metatags is to have Metatag more feature-complete and have a combined, convenient UI / UX, where you add these custom tags instead of a further separate module (where you wouldn't expect them).
Currently Metatags seems to lack such a functionality, right?
So +1 but it will need some work to integrate it flawlessly!
- 🇩🇪Germany Anybody Porta Westfalica
Currently you'd need to write code to define such metatags, I think? See #1466292: Document all Metatag's hooks → (D7)
@Anybody, Thanks for your inputs and linking to the old issue.
Looking forward to hearing what @DamienMcKenna thinks and share your wisdom on how to move it forward- 🇺🇸United States DamienMcKenna NH, USA
I think the next steps should be:
* Copy the module over and rename it to "metatag_custom_tags".
* Improve the module so it's more flexible. - 🇬🇧United Kingdom joachim
$custom_meta_settings = \Drupal::config('custom_meta.settings'); $custom_meta = $custom_meta_settings->get('tag') ?? [];
Storing multiple things inside a single settings config seems rather weird and cumbersome. It's also going to make managing site config harder for site builders, because all the metatag definitions are in one config file. This seems like a clear case for a config entity.
Moving the moving into this project would be a good time to create a new major version.
Moving the moving into this project would be a good time to create a new major version.
@joachim Happy to add you as a co-maintainer of custom_meta if you're interested in building a major version in the custom_meta contributed module OR we could build it in this issue
- 🇺🇸United States DamienMcKenna NH, USA
Moving the moving into this project would be a good time to create a new major version.
This would go into the next minor release of Metatag, per semver.
- Assigned to abhisekmazumdar
- 🇮🇳India abhisekmazumdar India
Assigning this to myself. I will be trying to port this module as a sub-module.
- Merge request !94Issue #3380911: Add Custom Meta as a submodule (Custom Metatags UI) → (Merged) created by abhisekmazumdar
- last update
over 1 year ago 113 pass, 8 fail - 🇮🇳India abhisekmazumdar India
A WIP MR has been raised. I will be working the following now:
- Converting the configurations to Config Entity.
- Code standards and improvements.
Looks for more feedbacks. Thank you.
- last update
over 1 year ago 113 pass, 8 fail - last update
over 1 year ago 113 pass, 8 fail - last update
over 1 year ago 113 pass, 8 fail - last update
over 1 year ago 113 pass, 8 fail - Issue was unassigned.
- Status changed to Needs work
over 1 year ago 12:26pm 30 November 2023 - 🇮🇳India abhisekmazumdar India
Apologies for the delay. I attempted to debug the failed test cases but was not successful. I will continue investigating, but I'm leaving this issue open for the community to assist.
- First commit to issue fork.
- last update
about 1 year ago 50 pass, 35 fail - last update
about 1 year ago 109 pass, 8 fail - last update
about 1 year ago 50 pass, 35 fail - last update
about 1 year ago 50 pass, 35 fail - last update
about 1 year ago 109 pass, 8 fail - Open on Drupal.org →Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8last update
about 1 year ago Not currently mergeable. - last update
about 1 year ago 50 pass, 35 fail - last update
about 1 year ago 109 pass, 8 fail - 🇺🇸United States DamienMcKenna NH, USA
FYI the 10.2.x test failures are being worked on in 📌 Adapt tests for Drupal 10.2 Needs work .
- last update
about 1 year ago Build Successful - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail Looks like the custom metatag save is not working. It's expected to come to /admin/config/search/metatag/custom-meta path here https://git.drupalcode.org/project/metatag/-/merge_requests/94/diffs#c3a...
However it's still stuck at /admin/config/search/metatag/custom-meta/add page- 🇮🇳India abhisekmazumdar India
Upon reviewing the test cases, I found that most of the failed cases are related to:
Drupal\Tests\metatag_custom_tags\Functional\CustomMetaTagPropertyTest::testCustomMetaTagPropertyWithPrefix Behat\Mink\Exception\ExpectationException: Current page is "/admin/config/search/metatag/custom-meta/add", but "/admin/config/search/metatag/custom-meta" expected.
Which basically points to a single file: https://git.drupalcode.org/project/metatag/-/merge_requests/94/diffs#c3a...
I think the values are not set correctly, so the page redirection is not happening. To confirm if the data is stored, I check the page redirection and the confirmed saved message.
I also tried using the page session variable to save the values, but it didn't help redirecting the page after saving successfully.
$page = $this->getSession()->getPage(); $page->selectFieldOption('attribute', $attribute); $page->fillField('label', 'foo'); $page->fillField('description', 'foo description'); $page->pressButton('Save');
- last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 110 pass, 8 fail - last update
about 1 year ago 127 pass, 10 fail - last update
about 1 year ago 128 pass, 8 fail - last update
about 1 year ago 128 pass, 8 fail - last update
about 1 year ago 132 pass, 4 fail - last update
about 1 year ago 135 pass - last update
about 1 year ago 135 pass - Status changed to Needs review
about 1 year ago 5:30pm 25 February 2024 - 🇺🇸United States DamienMcKenna NH, USA
Let's try to finish this for the upcoming 2.1.0 release.
- last update
about 1 year ago 132 pass - last update
about 1 year ago 132 pass - Status changed to Needs work
about 1 year ago 4:40pm 6 March 2024 - 🇺🇸United States DamienMcKenna NH, USA
This is really good work, thank you!
Reviewing the MR I have a few requests that would make it more robust:
- It needs to be able to control the tag name itself, as not all tags will be "meta" tags.
- It needs to be able to control the attribute where the value is stored. Wile most tags use "content", the "link" tag uses "href", so how would this be able to handle that scenario?
- All of the tests could be combined into one single test class with multiple test methods.
Otherwise this is really close.
- last update
about 1 year ago 132 pass - last update
about 1 year ago 132 pass - last update
about 1 year ago 132 pass - last update
about 1 year ago 134 pass - last update
about 1 year ago 134 pass - Status changed to Needs review
about 1 year ago 3:27pm 9 March 2024 #23
It needs to be able to control the tag name itself, as not all tags will be "meta" tags.
It needs to be able to control the attribute where the value is stored. Wile most tags use "content", the "link" tag uses "href", so how would this be able to handle that scenario?Thanks for raising it. I have accommodated that scenario. Please se
All of the tests could be combined into one single test class with multiple test methods.
Initially I merged all of them into single test class but then the administration and Tag testing should be part of the separate tests.
Sending back to review again- 🇺🇸United States DamienMcKenna NH, USA
Some additional feedback:
* I think the tab label is too confusing - what does "Metatag Custom Tags" mean? How about "Custom meta tags" or even just "Custom tags"?
* The labels on the form should be simplified to make it easier for a non-developer to understand, or at least someone who hasn't looked at the innards of a Metatag Tag plugin.
* It would be useful to provide an example of how the pieces fit together, either directly in the form or via hook_help().
* It would also be useful to control the group that the tags show up in.
* The custom group label should be easier to understand, e.g. "Custom tags".
* The Metatag plugin cache needs to be cleared when a custom tag is created or modified.
* The demo "sitename" tag needs improvements so it's clear what the values mean, e.g. just having "Sitename" as the description doesn't make it clear what it means or does. - Status changed to Needs work
about 1 year ago 5:30pm 21 March 2024 - 🇺🇸United States DamienMcKenna NH, USA
Forgot to add: the improvements are definitely working great, thank you for adding those naveenvalecha!
- last update
about 1 year ago 134 pass @DamienMcKenna
Thank you for the feedback!* I think the tab label is too confusing - what does "Metatag Custom Tags" mean? How about "Custom meta tags" or even just "Custom tags"?
I have changed it to "Custom tags"
* The labels on the form should be simplified to make it easier for a non-developer to understand, or at least someone who hasn't looked at the innards of a Metatag Tag plugin.
I have made it simpler now with more meaningful names. I'm open to accomodate more suggestions
* It would be useful to provide an example of how the pieces fit together, either directly in the form or via hook_help().
Added basic hook_help
* It would also be useful to control the group that the tags show up in.
I thought about the group should be controlled by the site builder but I don't want the custom tags should overlap with any existing module implementation and having them into a single group are better for maintainability prespective. What do you think?
* The custom group label should be easier to understand, e.g. "Custom tags".
I have changed it to "Custom tags"
* The Metatag plugin cache needs to be cleared when a custom tag is created or modified.
Done
* The demo "sitename" tag needs improvements so it's clear what the values mean, e.g. just having "Sitename" as the description doesn't make it clear what it means or does.
I have updated the description. I'm open to accomodate more suggestions
- Status changed to Needs review
about 1 year ago 10:35am 22 March 2024 - last update
about 1 year ago 126 pass - last update
about 1 year ago 126 pass - last update
about 1 year ago 126 pass - 🇬🇧United Kingdom 2dareis2do
I am trying to add the following custom meta tag:
<link rel="preload" as="image" href="image.webp">
Patch applies without issue.
After enabling this metatag submodule, I have option to create custom metatag. I am not sure how or if I can create my custom tag? See attached screenshot.
When trying to add new custom metetag I am getting the following:
Fatal error: Trait "Drupal\metatag\MetatagSeparator" not found in /var/www/html/web/modules/contrib/metatag/metatag_custom_tags/src/Plugin/metatag/Tag/MetaTagCustomTag.php on line 35
Looking at the codebase and change I cannot find any MetatagSeparator class?
https://git.drupalcode.org/project/metatag/-/merge_requests/94.diff
- 🇺🇸United States DamienMcKenna NH, USA
Are you using the patch with v2? MetatagSeparator is a trait stored in src/MetatagSeparator.php.
- 🇬🇧United Kingdom 2dareis2do
Sorry, i was still on 1.x
updating to 2 and fatal error is no more!
So as mentioned I am trying to get the custom attribute as mentioned above
If I enter
[node:field_picture:entity:field_media_image]" on="image, test" on="image
I get the following output:
<link rel="preload" href="" on="image"> <link rel="preload" href=""test" on="image">
So it seems that token is not being replaced and the quotes are a bit strange. Also it took me a while to figure out how to get that far!
- 🇬🇧United Kingdom 2dareis2do
Ok so with the following string/token
https://i0.wp.com/www.brixtonbuzz.com/wp-content/uploads/2024/05/streatham-food-1.jpg" as="image
I am able to generate:
<link rel="preload" href="https://i0.wp.com/www.brixtonbuzz.com/wp-content/uploads/2024/05/streatham-food-1.jpg" as="image">
However browser is still complaining:
<link rel=preload> cannot have the empty string as `as` value
So I guess
as="image"
might be confusing it. Not sure. - 🇺🇸United States DamienMcKenna NH, USA
The UI doesn't support adding more attributes, right now it's limited to just assign a single attribute, so you won't be able to assign the "as" or "on" attributes.
Does it work if the "on" or "as" attributes are present?
- 🇬🇧United Kingdom 2dareis2do
as determines the type so I think that is required.
Probably more than 2 attributes are required:
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload
@2dareis2do
Thank you for testing it out
@DamienMcKenna
Should I explore the option to add multiple attributes via UI? Are you open for this direction?- 🇺🇸United States DamienMcKenna NH, USA
Please do take a look -if you think it'll be a lot of work we can commit what we have first and then expand it later.
- 🇬🇧United Kingdom 2dareis2do
There might be a use case for a preload metatag submodule
- 🇺🇸United States DamienMcKenna NH, USA
Agreed - the need to specify multiple attributes of related data does make it a little harder to manage the way things are currently structured.
- 🇬🇧United Kingdom 2dareis2do
To help get the ball rolling I have created an issue for creating a module that supports the use of rel=preload attribute in head using link tag
https://www.drupal.org/project/metatag/issues/3450705 ✨ Add preload Meta as a submodule (Preload Metatags UI) Active
- 🇩🇪Germany Anybody Porta Westfalica
@naveenvalecha: So I guess the plan is now to integrate this as-is and then provide further improvements in follow-ups? Still the status is "Needs review"? Based on the recent comments, I think the state might be RTBC for as-is? Or what's left to be done?
@Anybody
nothing pending other than more features. It's under review and waiting for RTBC- Status changed to RTBC
10 months ago 4:54pm 19 June 2024 - 🇺🇸United States DamienMcKenna NH, USA
This is good to go - thank you naveenvalecha for all of your work to build out this functionality, the test coverage, etc.
@damienmckenna
Thanks for the update on the 2.1.x branch here https://www.drupal.org/project/metatag/issues/3423884#comment-15770300 🌱 Plan for Metatag 2.1.0 Active
I don't have the capability to change the target branch of the PR from 2.0.x to 2.1.x https://git.drupalcode.org/project/metatag/-/merge_requests/94
Could you do that and then I'll update the PR OR should I open a new PR?
Please advice.- 🇩🇪Germany Anybody Porta Westfalica
Merge conflicts need to be resolved now.
- 🇺🇸United States DamienMcKenna NH, USA
There's a regression in the tests against D11, that needs to be fixed then it'll be ready to go.
- 🇩🇪Germany Anybody Porta Westfalica
Tests failed with
Unable to install modules: module 'metatag_custom_tags' is incompatible
with this version of Drupal core.Added Drupal ^11 compatibility. I think it's compatible already? Otherwise, let's check the code again!
-
damienmckenna →
committed 0bbee4fa on 2.1.x authored by
abhisekmazumdar →
Issue #3380911 by naveenvalecha, abhisekmazumdar, eleonel, anybody,...
-
damienmckenna →
committed 0bbee4fa on 2.1.x authored by
abhisekmazumdar →
- Status changed to Fixed
5 months ago 10:49am 16 November 2024 Automatically closed - issue fixed for 2 weeks with no activity.