nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
166 stars 71 forks source link

`ads.txt` Not Appearing in GraphQL Output for SEOmatic (Craft 4) #1513

Closed rezzart-id closed 2 months ago

rezzart-id commented 2 months ago

Describe the bug

When querying SEOmatic via GraphQL to fetch frontend text templates, the ads.txt file does not appear in the response. Instead, there are two entries for humans.txt, one of which contains content that should belong to ads.txt.

To reproduce

Steps to reproduce the behaviour:

  1. In Craft CMS 4, enable the ads.txt, robots.txt, humans.txt, security.txt file through the Global SEO settings in the SEOmatic plugin.

  2. Run the following query via GraphQL:

    {
     seomatic {
       frontendTemplates {
         filename
         contents
       }
     }
    }
  3. Review the output from this query.

Expected behaviour

The ads.txt template should be included in the output with the correct filename and contents, and there should be no duplication of the humans.txt entry.

Actual Behavior:

Example Response:

{
  "data": {
    "seomatic": {
      "frontendTemplates": [
        {
          "filename": "humans.txt",
          "contents": "/* TEAM */\r\n\r\nCreator: [REDACTED]\r\nURL: [REDACTED]\r\n\r\n/* SITE */\r\n\r\nStandards: HTML5, CSS3\r\nComponents: Yii2, PHP, JavaScript\r\n"
        },
        {
          "filename": "robots.txt",
          "contents": "# robots.txt for http://localhost/\n\nsitemap: http://localhost/sitemaps-1-sitemap.xml\n\n# local - disallow all\n\nUser-agent: *\nDisallow: /\n\n"
        },
        {
          "filename": "humans.txt",
          "contents": "# ads.txt file for http://localhost/\n# More info: https://support.google.com/admanager/answer/7441288?hl=en\nhttp://localhost/,123,DIRECT\n"
        },
        {
          "filename": "security.txt",
          "contents": "# security.txt file for http://localhost/ - more info: https://securitytxt.org/\n\n# (required) Contact email address for security issues\nContact: mailto:user@example.com\n\n# (required) Expiration date for the security information herein\nExpires: 2025-09-18T17:00:58+08:00\n\n# (optional) OpenPGP key:\nEncryption: http://localhost/pgp-key.txt\n\n# (optional) Security policy page:\nPolicy: http://localhost/security-policy\n\n# (optional) Security acknowledgements page:\nAcknowledgements: http://localhost/hall-of-fame\n"
        }
      ]
    }
  }
}

Versions

Additional Notes:

I have tried clearing the SEOmatic cache and verifying that ads.txt is correctly enabled in the Global SEO settings, but the issue persists.

khalwat commented 2 months ago

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop as 3.5.4”,

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop-v4 as 4.1.4”,

Then do a composer clear-cache && composer update

…..

Craft CMS 5:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-seomatic": "dev-develop-v5 as 5.1.4”,

Then do a composer clear-cache && composer update

rezzart-id commented 2 months ago

@khalwat Thank you so much for the quick response and the fix! I applied the update and tested it, and I'm happy to report that it's working perfectly now. I really appreciate your help and support.