User tests: Successful: Unsuccessful:
Pull Request resolves #48710 .
com_contact category view only applied the Robots value from the menu item and dropped the metadata set on the category itself (Publishing tab: Robots, Author, etc.).
prepareDocument() in components/com_contact/src/View/Category/HtmlView.php now applies the category metadata after the parent call, the same way com_content does. A category-level Robots value overrides the menu item value on the category page. Individual contact pages are unchanged.
A system test is added to tests/System/integration/site/components/com_contact/Category.cy.js.
noindex, follow.<meta name="robots" ...> in the page source.There is no noindex, follow robots meta tag on the category page. The category's Robots setting is ignored.
<meta name="robots" content="noindex, follow"> is present on the category page.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Front End com_contact JavaScript Unit Tests |
| Labels |
Added:
Unit/System Tests
PR-6.2-dev
|
||
Hi @sachin9058,
Thank you for the quick response and for preparing this fix! I appreciate the effort you put into addressing the issue and adding automated tests.
I've reviewed the proposed changes, and the approach looks good to me. Since I already have a workaround in place on my site, I won't be testing the patch locally, but I'm happy to wait for its inclusion in an official Joomla release.
Thanks again for your contribution to Joomla!
I tested this side by side with #48729 on the same 6.2-dev instance (DDEV, PHP 8.3, MariaDB 11.8): 6.2-dev + this PR vs. 6.2-dev + #48729, category values set on the category and/or the category menu item, <head> read as a guest.
This PR does what it says: the contact category's Robots (and Author) now reach the category page, also over a menu item Robots value, and the new system test passes. php-cs-fixer, phpstan and eslint clean.
#48729 fixes the same thing one level up, in CategoryView::prepareDocument(), and covers more of #48710:
| this PR | #48729 | |
|---|---|---|
| contact category Robots / Author | ✔ | ✔ |
| contact category Meta Description | ✘ (menu value or nothing) | ✔ |
| newsfeed category (same bug) | ✘ | ✔ |
3rd-party views extending CategoryView |
✘ | ✔ |
| com_content category | unchanged | category now wins over menu (worth mentioning there) |
| system test | ✔ | – |
Your test passes unchanged with #48729. My suggestion: go on with #48729 and move the test there. Small note on the description: com_content doesn't quite do it "the same way" today. There the menu item Robots still wins when both are set, because CategoryView::prepareDocument() runs after com_content's own code; here the category wins.
Thank you for your contribution!
#48729 fixes the code on the right place, fixes the metadescription, and checks empty data as ou can see in the test above.
Thank you for your contribution!
#48729 fixes the code on the right place, fixes the metadescription, and checks empty data as ou can see in the test above.
Hi @Valentyn-M @richard67 The contact category's own Robots metadata is now applied on the category page, like in com_content. It includes a system test that I checked on both MySQL and Postgres. Could you take a look when you have time? Happy to change anything. Thanks!