drlukacs created the topic: HeadTag bug -- premature JFactory::getDocument() call
Since I installed HeadTag, my RSS feed's link stopped working, and displays the page itself instead of the feed. See for example
Following the suggestion of Yannick Gaultier, I discovered that the cause of the problem is that HeadTag calls JFactory::getDocument() prematurely, in the constructor, and thus an HTML document gets generated instead of allowing the routing to take its course. As Yannick explained:
As you like looking into code, this bug happens when a plugin calls JFactory::getDocument() or equivalent from the onAfterInitialize event. It's too early in the process and this forces Joomla to create an HTML document instead of an RSS ( it also happens with PDF). getDocument() should only be called after onAfterRoute.
I would propose that you move the code with getDocument() into onContentPrepare and onAfterRender.
michael replied the topic: HeadTag bug -- premature JFactory::getDocument() call
My site automation re-creates the update xml files at the top of every hour. I just pushed HeadTag 3.4.1, so the updatexml should recognize it in about 5 minutes (give or take with caching and CDN)
You can manually download it now though.
FYI, I was grabbing JDocument in the plugin __construct - so it was happening before onAfterInitialize - because this plugin operates both in content and at the system level, I ran this in onBeforeCompileHead, which should be safe enough since only HTML gets a compiled head. I may be able to clean up some unnecessary tests now, but the least I can do on short notice is to stop breaking your other extensions!