dolphiq / craft3-plugin-sitemap Goto Github PK
View Code? Open in Web Editor NEWA craft 3 plugin that provides an easy way to enable and manage an XML sitemap for search engines like Google
License: MIT License
A craft 3 plugin that provides an easy way to enable and manage an XML sitemap for search engines like Google
License: MIT License
The XML file is just blank on multi-language sites... :(
Currently, this plugin does not support Craft 4. Is an update with Craft 4 support planned or should we start looking for a replacement?
Is it suppose to look like this? I thought sitemaps were supposed to have HTML tags.
This is the sitemap that is being generated by the plugin. Could it be because it doesn't work on multi-site multi-lingual websites?
https://www.surdek.com/sitemap.xml
Hi, I'm encountering the following issue on admin/settings/sitemap:
Old enable channels are still active, 'Single pages' channel is the only one that keeps reverting back to its disabled state.
I am are using version 1.3.2.
Please advise on what actions to take. Thank you!
As subject, installed via composer in the Craft project folder.
Received success installation message.
Visited admin - Settings - Plugins
Nothing there for XML Sitemap
Per https://www.sitemaps.org/protocol.html, the loc
tag definition is as followed:
URL of the page. This URL must begin with the protocol (such as http) and end with a trailing slash, if your web server requires it. This value must be less than 2,048 characters.
However, the plugin is generating relative loc
values, which results in errors in Google's Search Console:
A little off-topic, but would you happen to know why /sitemap.xml
returns a 404 status on a NGINX/PHP-FPM stack even though it renders the XML? The only way I could submit a site map to Google's Search Console was by using /?p=actions/sitemap/sitemap/index
I cannot see the sitemap.xml on the site or access the settings.
How can I rectify this error?
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hrjlaws.craft_dolphiq_sitemap_entries' doesn't exist
The SQL being executed was: SELECT `sections`.`id`, `sections`.`structureId`, `sections`.`name`, `sections`.`handle`, `sections`.`type`, count(DISTINCT entries.id) AS `entryCount`, count(DISTINCT elements.id) AS `elementCount`, `sitemap_entries`.`id` AS `sitemapEntryId`, `sitemap_entries`.`changefreq` AS `changefreq`, `sitemap_entries`.`priority` AS `priority`
FROM `craft_sections` `sections`
LEFT JOIN `craft_structures` `structures` ON `structures`.`id` = `sections`.`structureId`
INNER JOIN `craft_sections_sites` `sections_sites` ON `sections_sites`.`sectionId` = `sections`.`id` AND `sections_sites`.`hasUrls` = 1
LEFT JOIN `craft_entries` `entries` ON `sections`.`id` = `entries`.`sectionId`
LEFT JOIN `craft_elements` `elements` ON `entries`.`id` = `elements`.`id` AND `elements`.`enabled` = 1
LEFT JOIN `craft_dolphiq_sitemap_entries` `sitemap_entries` ON `sections`.`id` = `sitemap_entries`.`linkId` AND `sitemap_entries`.`type` = "section"
WHERE `sections`.`dateDeleted` IS NULL
GROUP BY `sections`.`id`
ORDER BY `type`
Error Info: Array
(
[0] => 42S02
[1] => 1146
[2] => Table 'hrjlaws.craft_dolphiq_sitemap_entries' doesn't exist
)
↵
Caused by: PDOException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hrjlaws.craft_dolphiq_sitemap_entries' doesn't exist
in /media/dorothy/Data/websites/fl/deploy/vendor/yiisoft/yii2/db/Command.php at line 1299
I'm unable to navigate to the settings page for this plugin and therefore cannot manage the plugin at all. I'm on Craft Pro 3.5.7. When I go to the settings page, I get the following PHP error:
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: boolean = integer
LINE 4: ...tionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The SQL being executed was: SELECT "sections"."id", "sections"."structureId", "sections"."name", "sections"."handle", "sections"."type", count(DISTINCT entries.id) AS "entryCount", count(DISTINCT elements.id) AS "elementCount", "sitemap_entries"."id" AS "sitemapEntryId", "sitemap_entries"."changefreq" AS "changefreq", "sitemap_entries"."priority" AS "priority"
FROM "sections" "sections"
LEFT JOIN "structures" "structures" ON "structures"."id" = "sections"."structureId"
INNER JOIN "sections_sites" "sections_sites" ON "sections_sites"."sectionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
LEFT JOIN "entries" "entries" ON "sections"."id" = "entries"."sectionId"
LEFT JOIN "elements" "elements" ON "entries"."id" = "elements"."id" AND "elements"."enabled" = 1
LEFT JOIN "dolphiq_sitemap_entries" "sitemap_entries" ON "sections"."id" = "sitemap_entries"."linkId" AND "sitemap_entries"."type" = "section"
WHERE "sections"."dateDeleted" IS NULL
GROUP BY "sections"."id"
ORDER BY "type"
Error Info: Array
(
[0] => 42883
[1] => 7
[2] => ERROR: operator does not exist: boolean = integer
LINE 4: ...tionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
)
↵
Caused by: PDOException
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: boolean = integer
LINE 4: ...tionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
in /home/ubuntu/craft/vendor/yiisoft/yii2/db/Command.php at line 1293
When installing this plugin with Composer 1, the following deprecation notice is output:
Deprecation Notice: Class
dolphiq\sitemap\assetbundles\Sitemap\SitemapAsset
located in./vendor/dolphiq/sitemap/src/assetbundles/sitemap/SitemapAsset.php
does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.
Composer 2 was released on October 24, and is now the default version that will be installed, so it’s critical that this gets resolved ASAP, or people will start getting Class not found
errors.
To fix, run the following command:
> git mv src/assetbundles/sitemap src/assetbundles/Sitemap
Then commit your change and tag a new release.
(Note that you must use the git mv
command, as Git tends to not notice case-sensitive file renames otherwise.)
When I try to enable categories, this exception appears on save:
Argument 2 passed to craft\helpers\Db::idByUid() must be of the type string, null given, called in /Users/elfacht/htdocs/spillout/app/vendor/dolphiq/sitemap/src/services/SitemapService.php on line 127
Categories then remain disabled.
Craft 3.3.14
Plugin version: 1.2.0
When visiting www.mysite.com/sitemap.xml, I receive the following error:
This page contains the following errors:
error on line 3 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.
So there are 2 whitespaces/lines before the sitemap is shown...
Any idea on how to fix this?
Currently this plugin does not work anymore in a Craft 3.2 installation because of the added soft deletes and new drafting and versioning feature in Craft.
The custom built SQL queries would need to have added where checks for the element joins.
But besides that, it seems this plugin is not maintained anymore.
I just want this to stand here for others to see. :)
Hi,
I installed the plugin following the steps in the readme and have activated it in the CP. I have configured the sitemap by adding some structures and saved my changes.
However, I get a 404 when trying to visit "URL/sitemap.xml".
I am developing locally if that could affect anything.
Is anyone else having this issue?
the plugin puts expired entries into the sitemap, which creates problems for bots, as the sites can not be found.
it would be great if the plugin checks if there's a noindex in the meta-tags and doesn't put the concerned sites into the sitemap. alternative: a possibility to add certain urls in the plugin that should never show up in the sitemap.
I have installed and configured your plugin. But I am getting a 404 when I try to access the sitemap. Is there something I need to point in routes? I think I might be missing a step.
For structures, not every level of the structure is something we want to show in our sitemap. It would be great to have a secondary dropdown in the UI that allows the user to select which entry types and levels of a structure should be included in the sitemap.
Also, it would be nice to have some query event hooks for more advanced tweaks.
We have disabled "Enable on the front end" for a site, because it is not live whilst waiting for the translations. It is site ID 2.
But the xml sitemap plugin is still trying to generate a sitemap for it, and as such, returns an error due to the UrlHelper::siteUrl in your plugin returning an invalid site id.
I assume your code is not checking if a site is enabled on front end or not.
Is it possible this can be fixed, because we are unable to generate a sitemap now, not until we enable the other site.
Thanks
Hi, thanks for a great plugin - it's the first thing I install on my sites.
One thing I noticed on my most recent venture is that posts that appear in the future appear in the sitemap.
I have set up and scheduled several posts to go live over the next few weeks by using the post date and they all appear in the sitemap.
Thanks again
Getting URLs like this showing in the sitemap: /__temp_gLouMRSa9uMX3szi8Orcsal1jmpoaP2uVnyt
When trying to access the plugins settings via the settings page, I get the following error:
LINE 4: ...tionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The SQL being executed was: SELECT "sections"."id", "sections"."structureId", "sections"."name", "sections"."handle", "sections"."type", count(DISTINCT entries.id) entryCount, count(DISTINCT elements.id) elementCount, "sitemap_entries"."id" AS "sitemapEntryId", "sitemap_entries"."changefreq" AS "changefreq", "sitemap_entries"."priority" AS "priority"
FROM "sections" "sections"
LEFT JOIN "structures" "structures" ON "structures"."id" = "sections"."structureId"
INNER JOIN "sections_sites" "sections_sites" ON "sections_sites"."sectionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
LEFT JOIN "entries" "entries" ON "sections"."id" = "entries"."sectionId"
LEFT JOIN "elements" "elements" ON "entries"."id" = "elements"."id" AND "elements"."enabled" = 1
LEFT JOIN "dolphiq_sitemap_entries" "sitemap_entries" ON "sections"."id" = "sitemap_entries"."linkId" AND "sitemap_entries"."type" = "section"
GROUP BY "sections"."id"
ORDER BY "type"
Error Info: Array
(
[0] => 42883
[1] => 7
[2] => ERROR: operator does not exist: boolean = integer
LINE 4: ...tionId" = "sections"."id" AND "sections_sites"."hasUrls" = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.```
I believe that 1 for `true` would work in mysql, but it breaks in postgres:9.6.5
The Sitemap settings page displays sections that have been deleted. I'm guessing it should be excluding sections where dateDeleted
is not NULL
in the database.
Hi,
is there an idea how to support multilingual sites?
For example google suggest to treat them within the sitemap.xml like so per site (for example en
as default and de
as second language):
<url>
<loc>http://www.example.com/english/</loc>
<xhtml:link
rel="alternate"
hreflang="de"
href="http://www.example.com/deutsch/"
/>
</url>
Right now the plugin will generate it like so:
<url>
<loc>http://www.example.com/english/</loc>
</url>
<url>
<loc>http://www.example.com/deutsch/</loc>
</url>
Is there any support for multilingual setups planned or possible right now?
Getting duplicated URLs showing in the sitemap, this might be to do with draft entries. Can this be fixed please? Thanks
On my website, draft URL appeared in sitemap:
http://craftsnippets.com/articles/__temp_R4uxHKjiiLvmWgyYyIoTpw5G1idlFLCJgv71
Hi!
I understand this is still a work in progress, but is it usable? If not, can I help?
Fixing a sitemap for our craft3 site is on my todo... Thnx!
The current implementation is not multi-site compatible.
You are using $app->config->general->siteUrl
, which in a multisite, can be an array.
Ideally, I think you'd want to structure things so you're actually dealing with craft\elements\Element
, so you can just use craft\base\Element::getUrl()
. That you don't have to monkey around with building the url yourself, making exceptions for __home__
, among other things.
If not that, it would at least be better to use craft\helpers\UrlHelper::url($item['uri'])
, rather than getting the raw config var, so this would work for multi-sites.
Is there any plan to make this compatible with project.yaml config files to hold the setttings?
On sites where allowAdminChanges is false there is no way to update the settings without manually editing the database at the moment as the project.yaml doesn't update with changes and the site where changes are disallowed shows an error on save attempt.
If you have the dolphiq redirect manager plugin installed, and the 'catch all template' option enabled, sitemap.xml url returns a 404.
Hey, just found that if I update a category, removing an existing uriFormat
, the project config files will update as follows:
+++ b/craft/config/project/categoryGroups/sectors--fdd1be2c-d545-4af2-9d6a-3a1bb2082e31.yaml
@@ -291,9 +291,9 @@ handle: sectors
name: Sectors
siteSettings:
146e7a6b-f0ca-4f39-ba5d-d9eb009fc426: # UDL (en-GB)
- hasUrls: true
- template: sectors/_category
- uriFormat: '{% if object.level == 1 %}sectors/{slug}{% else %}{parent.uri}/{slug}{% endif %}'
+ hasUrls: false
+ template: null
+ uriFormat: null
structure:
maxLevels: null
uid: 0cc96d4e-d9ac-4f49-bc9d-db9e145926de
diff --git a/craft/config/project/dolphiq_sitemap_entries/1d8dd907-afd2-411d-a45b-3e213f5ff8fe.yaml b/craft/config/project/dolphiq_sitemap_entries/1d8dd907-afd2-411d-a45b-3e213f5ff8fe.yaml
index b8d2cce2..13a98673 100644
--- a/craft/config/project/dolphiq_sitemap_entries/1d8dd907-afd2-411d-a45b-3e213f5ff8fe.yaml
+++ b/craft/config/project/dolphiq_sitemap_entries/1d8dd907-afd2-411d-a45b-3e213f5ff8fe.yaml
@@ -1,4 +1,4 @@
changefreq: weekly
-linkId: fdd1be2c-d545-4af2-9d6a-3a1bb2082e31 # Sectors
+linkId: null
priority: 0.5
type: category
diff --git a/craft/config/project/dolphiq_sitemap_entries/6d47467d-1bd2-4ea1-ae48-e17d430cce42.yaml b/craft/config/project/dolphiq_sitemap_entries/6d47467d-1bd2-4ea1-ae48-e17d430cce42.yaml
index 8256fc35..30ccf941 100644
--- a/craft/config/project/dolphiq_sitemap_entries/6d47467d-1bd2-4ea1-ae48-e17d430cce42.yaml
+++ b/craft/config/project/dolphiq_sitemap_entries/6d47467d-1bd2-4ea1-ae48-e17d430cce42.yaml
@@ -1,4 +1,4 @@
changefreq: weekly
-linkId: c22c47f9-3b49-43b0-906d-a7ae8fcf36ba # International
+linkId: cbcce34a-495a-4916-8335-8d4a3217d194
priority: 0.5
type: category
diff --git a/craft/config/project/dolphiq_sitemap_entries/d2bdad24-5ed1-4d5f-88cd-7cb42f7bbfbe.yaml b/craft/config/project/dolphiq_sitemap_entries/d2bdad24-5ed1-4d5f-88cd-7cb42f7bbfbe.yaml
index 22433214..13a98673 100644
--- a/craft/config/project/dolphiq_sitemap_entries/d2bdad24-5ed1-4d5f-88cd-7cb42f7bbfbe.yaml
+++ b/craft/config/project/dolphiq_sitemap_entries/d2bdad24-5ed1-4d5f-88cd-7cb42f7bbfbe.yaml
@@ -1,4 +1,4 @@
changefreq: weekly
-linkId: 9ca9c766-0fe7-406a-aa76-ef312b1cb6c3 # Services
+linkId: null
priority: 0.5
This unfortunately will throw an error on running a migration:
- adding dolphiq_sitemap_entries.6d47467d-1bd2-4ea1-ae48-e17d430cce42 ...
error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'linkId' cannot be null
The SQL being executed was: INSERT INTO `craft_dolphiq_sitemap_entries` (`uid`, `linkId`, `type`, `priority`, `changefreq`, `dateCreated`, `dateUpdated`) VALUES ('6d47467d-1bd2-4ea1-ae48-e17d430cce42', NULL, 'category', 0.5, 'weekly', '2021-07-06 15:22:22', '2021-07-06 15:22:22')
I am able to rectify the issue by going into: admin/settings/sitemap
and resaving the sitemap settings
When looking at the settings I am being redirected from
/admin/settings/plugins/sitemap
to /admin/settings/sitemap
which is not available.
I am assuming this is something in my setup but I honestly can't think what?!? Any chance you could shed any light on this.
Apologies if this is not the correct way to reach out to you.
I have vacancy entries that are only live for so many weeks, but even when removed they are still showing in the sitemap and causing crawl errors with Google Search Console.
Is there a way to reset the sitemap XML when this happens? I already have the change frequency set to daily
Thank you!
When I installed this today from the command line, I received the following notice:
Deprecation Notice: Class dolphiq\sitemap\assetbundles\Sitemap\SitemapAsset located in ./vendor/dolphiq/sitemap/src/assetbundles/sitemap/SitemapAsset.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
It doesn't stop it from working immediately.
I'd love to see Products being supported - is this planned?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.