getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[seo-magic] Front page broken when changing settings e.g. when adding global keywords #27

Closed kees-closed closed 3 years ago

kees-closed commented 3 years ago

Hi,

I can't conclude this with 100% if this is related to seo-magic or Grav 1.7.3. But I can reproduce this problem with seo-magic 1.0.2 and 1.0.3 on Grav 1.7.4 with PHP 7.4.14 on CentOS (Plesk).

In Gist I uploaded 2 HTML source files, one with "error" and one with "no-error" in the name. Best to download these raw files and open them with e.g. Chrome.

The "no-error" HTML source file contains the website source as it should be. The "error" HTML source file is the one that causes issues. From the looks of it, it seems that the sitemap is processed in the front page, which starts at div id="top". This is a modular page, when I disable the modular item which contains this div, then the next div of the modular pages is used. So this does not appear to be triggered by the shortcode plugin or anything else in the top of the page.

This error is sometimes triggered when I regenerate the SEO data. But it's consistently reproduced when I add or remove a global keyword with the seo-magic plugin. Only the front page is affected by this. Other pages appear normal.

The temporary fix is to clear the cache, the problem resurfaces when I add/remove a global keyword again. Clearing the cache does fix the issue every time. The website: www.zeitgeistbeweging.nl

I don't see anything pop up in the general log when the error occurs. Advice to further pinpoint the cause is welcome.

rhukster commented 3 years ago

Defaced usually means the site has been modified by a malicious attack. I think you mean that the site is 'broken' or 'different' from expected? Defaced is a strong term :)

I don't know what I'm looking for in the source files. Perhaps you could provide screenshots of how it 'should' look and how it looks when it's not as expected? I looked at your URL, and it looks fine to me, but that doesn't mean it's not as expected.

It does sort of sound like a cache issue, but it could be related to your other issue regarding translation, but I'll wait till I see the screenshots to get a fuller understanding of what's going on.

kees-closed commented 3 years ago

Here is a screencast where I reproduce the issue I mention in my first comment. It could be a caching issue. Every morning the front page is broken as well. I run a scheduler to clear the cache + old cache at night.

In the screencast you can see the content of my sitemap.xml on the frontpage. After clearing the cache, this is fixed.

I was using file caching. I switched now to Redis. The same problem persists. So I suppose it's not related to a caching driver. I've disabled the seo-magic plugin for now, to see if the problem resurfaces. Then we may be able to exclude the plugin as the cause.

rhukster commented 3 years ago

That is very odd and looks to me like a Grav 1.7 conflict or issue with another plugin, not anything that SEO-Magic could do.

I noticed you had 37 plugins (as indicated by your sidebar). I suggest disabling any non-core plugins (temporarily) to try to narrow down if a specific plugin is causing a problem.

kees-closed commented 3 years ago

I'll experiment a bit. But the only non-core plugins I have are cookieconsent and ganalytics. Below is the full list.

$ /opt/plesk/php/7.4/bin/php ~/www.zeitgeistbeweging.nl/bin/gpm index --installed-only --plugins-only

GPM Releases Configuration: Stable

PLUGINS [ 37 ]

Packages table
--------------

+-------+-------------------+------------------+---------+-----------+
| Count | Name              | Slug             | Version | Installed |
+-------+-------------------+------------------+---------+-----------+
| 1     | Auto Date         | auto-date        | v1.0.2  | installed |
| 2     | Editor Buttons    | editor-buttons   | v1.2.1  | installed |
| 3     | Featherlight      | featherlight     | v1.5.0  | installed |
| 4     | Data Manager      | data-manager     | v1.2.0  | installed |
| 5     | Cookie Consent    | cookieconsent    | v0.4.0  | installed |
| 6     | Custom CSS        | custom-css       | v0.2.2  | installed |
| 7     | Problems          | problems         | v2.0.3  | installed |
| 8     | Pagination        | pagination       | v1.4.2  | installed |
| 9     | Google Analytics  | ganalytics       | v1.4.0  | installed |
| 10    | Database          | database         | v1.0.2  | installed |
| 11    | PreCache          | precache         | v1.2.0  | installed |
| 12    | Reading Time      | readingtime      | v1.4.0  | installed |
| 13    | Git Sync          | git-sync         | v2.1.1  | installed |
| 14    | Highlight         | highlight        | v1.4.2  | installed |
| 15    | Error             | error            | v1.7.1  | installed |
| 16    | Shortcode UI      | shortcode-ui     | v3.0.0  | installed |
| 17    | Image Captions    | image-captions   | v2.0.2  | installed |
| 18    | Page Toc          | page-toc         | v1.1.1  | installed |
| 19    | TNT Search        | tntsearch        | v3.3.0  | installed |
| 20    | Views             | views            | v1.1.0  | installed |
| 21    | Taxonomy List     | taxonomylist     | v1.3.5  | installed |
| 22    | Markdown Notices  | markdown-notices | v1.1.0  | installed |
| 23    | Feed              | feed             | v1.8.0  | installed |
| 24    | Anchors           | anchors          | v1.5.4  | installed |
| 25    | Archives          | archives         | v2.0.2  | installed |
| 26    | Sitemap           | sitemap          | v2.0.2  | installed |
| 27    | DevTools          | devtools         | v1.4.2  | installed |
| 28    | Email             | email            | v3.1.0  | installed |
| 29    | Login             | login            | v3.3.8  | installed |
| 30    | YouTube           | youtube          | v3.1.0  | installed |
| 31    | Form              | form             | v4.3.0  | installed |
| 32    | License Manager   | license-manager  | v1.0.1  | installed |
| 33    | Flex Objects      | flex-objects     | v1.0.1  | installed |
| 34    | Admin Panel       | admin            | v1.10.2 | installed |
| 35    | Related Pages     | relatedpages     | v1.2.3  | installed |
| 36    | Seo Magic         | seo-magic        | v1.0.3  | installed |
| 37    | Shortcode Core    | shortcode-core   | v5.0.4  | installed |
+-------+-------------------+------------------+---------+-----------+
kees-closed commented 3 years ago

We have a winner. When I disable precache the error doesn't occur anymore. I've reproduced this about 10 times. Once I enable precache again, the error returns.

rhukster commented 3 years ago

Ah yes! Precache has sort of been replaced by warm-cache. But SEO-Magic already does the work of warm-cache as it hit's every page in the sitemap and does the the job warm-cache would do.

So in short you really don't need precache anymore, or warm-cache for that matter. If you want to warm the cache, just click the SEO-Magic regenerate button.

kees-closed commented 3 years ago

Awesome, thanks!

kees-closed commented 3 years ago

If you want to warm the cache, just click the SEO-Magic regenerate button.

One more question. I run a scheduler job at night to clear/purge the cache. Does seo-magic warm the cache after that? Or is this a manual operation? Did precache do this better? In the context of making sure the cache is warm again after clearing it?

w00fz commented 3 years ago

It is a manual operation and you can reprocess the SEO data (which would warm the cache) by scheduling the command bin/plugin seo-magic process https://yoursite.com/sitemap.xml -s right after you have cleared the cache.

Also unrelated to the scheduling per-se but just so you know, every time you edit a page, SEO magic reprocesses that page specifically to ensure accuracy. By doing so it does re-warms the cache for the page also.

kees-closed commented 3 years ago

I appreciate the workaround. But wouldn't it be better to improve precache to work with seo-magic in this case? Or is precache officially deprecated at this point in favor of warmcache? It would be cleaner and more helpful if the scheduler option is included in the settings to warm the cache again with seo-magic. Not for me, but for everyone. It might also be nice to create a dependency conflict with precache when seo-magic is installed. Just my 2 cents.

rhukster commented 3 years ago

precache isn't a reliable way to cache the pages. It's doesn't accurately cache the pages like the newer warm-cache or even seo-magic indexing does using the sitemap.xml and crawling the page like a proper browser does. So while it should be fixed to not cause an error, it's not the best solution.

I will also look at adding seo-magic regeneration as a preset to the scheduler like other plugins have.