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] Only one page is processed #334

Closed kees-closed closed 1 year ago

kees-closed commented 1 year ago

Please describe your issue with as much detail as possible. Please include versions of the product. As well as Grav, admin plugin or any other plugins involved.

Also please provide detail steps to reproduce the issue or sample code that exhibits the issue. The easier you make it for us to reproduce the issue, the faster we can resolve the it.

/opt/plesk/php/8.1/bin/php ~/www.zeitgeistbeweging.nl/bin/plugin seo-magic -vvv process https://www.zeitgeistbeweging.nl/sitemap.json

Processing Pages for SEO Data
=============================

200 [47%]: https://www.zeitgeistbeweging.nl/sitemap.json

Completed SEO-Magic processing in 0.7s

 [OK] SEOMagic processed for 1/1 pages                                                                                                                                                                                                       

My user config:

$ cat config/plugins/seo-magic.yaml 
enabled: true
enable_admin_page_events: true
enable_quicktray: true
enable_seo_report: true
log_results: true
user_agent: 'Grav SEOMagic Plugin'
robots: all
body_selectors:
  - .magic-content
  - 'article .rich-text'
  - '#body-wrapper p'
  - '#start'
ignore_routes: null
custom_stopwords:
  - content
  - '&'
opengraph:
  enabled: true
twitter:
  enabled: true
  username: null
  card: summary_large_image
  reading_time: true
facebook:
  enabled: true
  appid: null
keep_utf8_chars: true
global_keywords: null
autogenerate_desc: true
autogenerate_keywords: true
desc_summarization_method: textrank
images:
  type: webshot
  webshot_url: 'https://webshot.getgrav.org'
  image_name: og-image.jpg
  image_attribute: hero_image
  default_image: /user/themes/tzm/images/favicon.png
  size:
    x: '1200'
    'y': '630'
sitemap_url: /sitemap.xml
keywords_default_fallback: true
desc_default_fallback: true
rhukster commented 1 year ago

Sorry it's taken me so long to reply to this. Took me a while to work out what was going on. It's specific to your webserver, in that it's returning application/json; charset=utf-8 for the content-type when requesting: https://www.zeitgeistbeweging.nl/sitemap.json, where typically this is only application/json. I've adapted the json check to accept strings that contain extra info.

classes/SEOGenerator.php line: 37:

            $content_type = $url_response->getHeaders()['content-type'][0] ?? null;
            if (Utils::contains($content_type, 'application/json')) {

This will be in the next released.