Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Schema.org: Fix error when menu item doesn't exist #42662

Draft
wants to merge 3 commits into
base: 5.2-dev
Choose a base branch
from

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Jan 16, 2024

Summary of Changes

When having the schema.org plugin enabled and opening a URL with a non-existing Itemid, the plugin throws a fatal error.

Testing Instructions

  1. Open a URL like index.php?Itemid=666&option=com_content&view=category&id=2
  2. See the fatal error
  3. Apply patch
  4. See error go away.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@fgsw
Copy link

fgsw commented Jan 17, 2024

Error View not found [name, type, prefix]: category, html, Administrator stay with applied patch.

@Hackwar
Copy link
Member Author

Hackwar commented Jan 17, 2024

You have to open the URL in the frontend.

@fgsw
Copy link

fgsw commented Jan 17, 2024

I have tested this item ✅ successfully on 0c0938c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42662.

1 similar comment
@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 0c0938c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42662.

@rdeutz rdeutz added PR-5.0-dev RTC This Pull Request is Ready To Commit and removed PR-5.0-dev labels Jan 17, 2024
@LadySolveig LadySolveig modified the milestone: Joomla! 5.1.0 Jan 17, 2024
@bembelimen
Copy link
Contributor

I think tis is the wrong approach, just because there is no menu (not sure if this ever should happen...but that's another topic) you should not skip all the output.

It just needs a headline and a clean check for meta data. The headline should be available somewhere (I mean, it's there in the normal output) and the if for the meta can add the $menu && ....

But again, don't disable the whole schema output just because there is no menu.

@Quy Quy added Updates Requested Indicates that this pull request needs an update from the author and should not be tested. and removed Updates Requested Indicates that this pull request needs an update from the author and should not be tested. RTC This Pull Request is Ready To Commit labels Jan 20, 2024
@Hackwar
Copy link
Member Author

Hackwar commented Jan 21, 2024

This issue only shows up when the Itemid is invalid, so when the Itemid points to a non-existing menu item. In that case we are missing large parts of our configuration and should thus disable the schema output. This is NEVER a site which you want to have indexed. Remember, when we have a /component/content/category page, we still fall back to the default menu item. This only happens when the page really is broken. I also don't see how we could do this more gracefully, since we are missing a name for the blog and the description. I would still ask to merge this as is.

@Quy Quy removed the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jan 22, 2024
@bembelimen
Copy link
Contributor

If it's a broken page, then throw an error? Make a redirect? Make it no-index?

@formfranska
Copy link

formfranska commented Jan 23, 2024

If it's a broken page, then throw an error? Make a redirect? Make it no-index?

The page does not exist. It's an empty category with no articles in it as I described in https://forum.joomla.org/viewtopic.php?f=834&t=1006471

I have disabled the Schema org plugin which fixes the issue for now (to avoid getting 500 errors in Google Search Console).

@Hackwar Hackwar added PBF Pizza, Bugs and Fun bug labels Feb 20, 2024
@bembelimen bembelimen marked this pull request as draft February 20, 2024 23:36
@bembelimen bembelimen added the RMDQ ReleaseManagerDecisionQueue label Feb 20, 2024
@Hackwar Hackwar changed the base branch from 5.0-dev to 5.1-dev February 21, 2024 20:27
@Hackwar Hackwar changed the title [5.0] Schema.org: Fix error when menu item doesn't exist [5.1] Schema.org: Fix error when menu item doesn't exist Feb 21, 2024
@TLWebdesign
Copy link

I have tested this item ✅ successfully on 949a0da

Works fine!
After applying patch i got this message instead of an error: There are no articles in this category. If subcategories display on this page, they may have articles.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42662.

@crimle
Copy link

crimle commented Feb 24, 2024

I have tested this item ✅ successfully on 949a0da


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42662.

@7at1blow
Copy link

I have tested this item ✅ successfully on 949a0da


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42662.

@miguelvazquez
Copy link

I have tested this item ✅ successfully on 0c0938c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42662.

@Hackwar Hackwar added the RTC This Pull Request is Ready To Commit label Feb 26, 2024
@bembelimen bembelimen added Updates Requested Indicates that this pull request needs an update from the author and should not be tested. and removed RTC This Pull Request is Ready To Commit labels Mar 2, 2024
@bembelimen
Copy link
Contributor

bembelimen commented Mar 2, 2024

Removed RTC, see: #42662 (comment)

Just fix line 319 + 323 instead of throwing everything away

@HLeithner HLeithner changed the base branch from 5.1-dev to 5.2-dev September 2, 2024 08:27
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.2-dev.

@HLeithner HLeithner changed the title [5.1] Schema.org: Fix error when menu item doesn't exist [5.2] Schema.org: Fix error when menu item doesn't exist Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PBF Pizza, Bugs and Fun PR-5.2-dev RMDQ ReleaseManagerDecisionQueue Updates Requested Indicates that this pull request needs an update from the author and should not be tested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.