Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently xmlsitemap uses only the node language to generate URLs and ignores nodes that have been translated with entity translation.
Comment | File | Size | Author |
---|---|---|---|
#185 | interdiff-1481798-177-185.txt | 518 bytes | james.williams |
#185 | xmlsitemap-add_support_for_entity_translation-1481798-185.patch | 19.86 KB | james.williams |
| |||
#142 | interdiff_139-142.txt | 203 bytes | hctom |
#142 | xmlsitemap-add_support_for_entity_translation-1481798-142.patch | 14.21 KB | hctom |
| |||
#137 | xmlsitemap-add_support_for_entity_translation-1481798-137.patch | 14.16 KB | phjou |
Comments
Comment #1
das-peter CreditAttribution: das-peter commentedI just came across this issue. Atm. for me it looks like to support this we've to alter the database schema. Currently the xmlsitemap table has
id
andtype
as key and a row can have a single language.But since with entity translation the
id
/type
combination will be shared for multiple languages we loose the unique identifier.And I'm not sure if the "simple" introduction of
language
is really sustainable.Btw. for me this issue is related to following other issues:
#1461670: Generalize to work with any Entity Type
#891696: Consistently use link, bundle, and entity loaders everywhere
All of them are mainly about to better integrate with the "core" entity system.
Comment #2
marcoka CreditAttribution: marcoka commentedrelated too #1370394: Set correct language for url()
Comment #3
romualdbrisson CreditAttribution: romualdbrisson commentedHere is a patch for a simple solution on this issue.
You have to rebuild links.
Comment #4
hefterbrumi CreditAttribution: hefterbrumi commentedThis doesnt work for me
Comment #5
muschpusch CreditAttribution: muschpusch commentedi started working on entity translation support over here: #1370394: Set correct language for url()
Comment #6
hefterbrumi CreditAttribution: hefterbrumi commentedgreat news indeed
Comment #7
e.escribano CreditAttribution: e.escribano commentedI needed the implementation for entity_translation myself so I made a patch that includes also support for taxonomy terms.
EDIT:
Didn't notice that the alter in the install file gave me problems when a node was saved. It is not a complete patch yet.
Comment #8
e.escribano CreditAttribution: e.escribano commentedComment #9
matsbla CreditAttribution: matsbla commentedThis module did the job for me:
https://www.drupal.org/project/node_translation_sitemap
Comment #10
titouille#7 seems to be broken with last xmlsitemap version. follow code must be edited in xmlsitemap_link_save function (in xmlsitemap.module) :
Because patch add language as primary key, drupal_write_record must pass 'language' as primary key to work correctly.
Comment #11
das-peter CreditAttribution: das-peter commentedRe-rolled #7, incorporated #10 and centralized the translation handling.
New there's
xmlsitemap_get_entity_languages()
which fetches the available languages.This new function just returns the languages of published translations. It also uses the translation handlers to get the information instead accessing the data directly - this should be safer.
And last but not least it just handles entities with entity_translation enabled.
Comment #12
J-Lee#11 is working for me with entity translated nodes/fields.
Thank you.
Comment #13
J-LeeIt seems, I was to fast at #12 ....
If found that nodes without translations are added to the sitemap too.
I have two languages (en and de) with a node which is only available in en.
At the sitemap there is an entry for /en/[node-alias] which is ok.
But there is an entry for /de/node/[nid] too.
I'm using entity translation for title-field and body.
Comment #14
ph08n1x CreditAttribution: ph08n1x commented#11 worked for me too, thank you so much! :D
in regards to showing languages that don't have translations, luckily all my pages are translated in all three of my languages... hmmm mabe there is a way to check the state of node if it is published for that language...?
Comment #15
ph08n1x CreditAttribution: ph08n1x commentedHi J-Lee perhaps this will help you (sorry about not supplying a patch but super busy today!):
I saw that the if statement only checks if status is empty it does not check if status is equal to 1 (i.e. is the entity published).
Although I'm not sure if that is checking if the entity translation is published or if it's just checking if the default language node is published... Give it a go tho :D
Comment #16
das-peter CreditAttribution: das-peter commented@ph08n1x empty() should be fine:
This means 1, TRUE, 'published' etc. are considered as published. And as far as I know status is here an int or bool.
Edit: Fixed formatting
Comment #17
J-LeeI found the issue from #12 ...
Because I used the node_translation_sitemap (from #9) before, I have multible 'node_translated_de' entries at the 'type' column in the xmlsitemap table.
I had to trunkate the xmlsitemap table (without the first row, which is the front page) and rebuilding the links.
Now it is working.
@ph08n1x: Thank you for your suggestion.
Unpublished translations are not displayed, so #15 is not needed, I think. But it will be fine if someone can confirming it.
Edit: das-peter has confirmed it a few minutes before :)
Comment #18
MXTSorry guys,
a banal question: applying patch in #11 is enough or I have to install XML_sitemap_internationalization submodule also?
Thank you very much
Comment #19
J-LeeXML sitemap internationalization adds one sitemap for each language. E.g. www.example.com/en/sitemap.xml and www.example.com/de/sitemap.xml. If you only want one sitemap with multiple languages, patch #11 is enough.
Comment #20
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedMoving to NW, because there's a few things that seems wrong with regards to the schema handling.
This is adding a xmlsitemap_node_update_6202 update function, to tweak the xmlsitemap table. That update function number seems off for a Drupal 7 module (the update will still run because the last update in that file is 6201, so every Drupal 7 site out there have a schema_version of 6201 for xmlsitemap_node), but more importantly, xmlsitemap_node isn't the mode that provides the xmlsitemap table in the first place.
I think instead, the module should add an update function to xmlsitemap.install, and also tweak the default primary key defined in xmlsitemap_install to handle new installations.
Comment #21
das-peter CreditAttribution: das-peter commentedAddress points from #20.
Comment #22
J-LeePatch #21 is working on a clean Drupal 7.37 installation with latest title- and entity_translation module.
Thank you das-peter.
Comment #23
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedThanks das-peter, the schema part does look a lot better now. Sadly found a bunch of others issues while testing various things that I had not in the first review :-(
First problem is due to the change in the
$existing
in xmlsitemap_link_save being conditional on entity translation activation, while the primary key and the drupal_write_record are not. That means that if you don't have entity translation enabled and the entity language changes, you won't get any update for this sitemap link anymore.(To reproduce that issue: install Drupal core, its bundled Locale and Translation modules, install XML Sitemap and XML Sitemap Node, add another language and change the article bundle multilingual settings from Disabled to Enabled while adding that content type to your site map. Then add an article node in English, save it, and change the node language to something else… No update to the xmlsitemap table anymore)
Attached patch tries to fix the problem by always using the same key while checking for existence and updating, which fix that problem, but I'm not sure that's completely correct either.
I think that's the only problem for people not using entity translation ; moving to problems specific to entity translation now:
xmlsitemap_link_delete
, which should also probably be tweaked to accept an optional language parameter now that this is part of the primary key ? As it is now, it's misleading, because its name implies that it'll delete a single link, while in fact it can deletes a bunch of them, and the code is adding a link_delete_mutliple call which will target a single linkAt that point I think we need a module maintainer to chime in, to have an idea of how invasive the acceptable changes can be. There's a lot of code in there that expects the primary key to be (type, id), and changing them all is going to be time consuming.
Comment #24
maxplus CreditAttribution: maxplus commentedHi,
First of all: thanks for the great work done already!
I have just tested the patch from #23 and I'm getting this error:
Then I tested the patch from #21, and that runs fine.
=> Now I have three correct xml-sitemaps, one for every language (Dutch, French and English)
Using Drupal 7.36, XML sitemap 7.x-2.2+3-dev and Entity Translation 7.x-1.0-beta4
Comment #25
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedThe fatal error in #24 was due to a bad copy & paste between xmlsitemap_node and xmlsitemap_taxonomy, sorry for that. Attached fixed patch + interdiff.
Comment #26
gstout CreditAttribution: gstout commentedLatest patch worked great. We should get this into a dev release.
Comment #27
Neograph734The patch appears to be working nicely, and applied flawless. It would indeed be nice if this could get committed. Should we test more or is this RTBC?
Comment #28
colanI'll be testing this very shortly. Seems to apply to the latest dev.
Comment #29
colanRemoving tag.
Comment #30
colanCode looks good and works well. It also appears to solve the problem described in #1370394: Set correct language for url(). Here are the steps I took to get this up & running:
Can anyone comment on #2220641: Merge this function back to xmlsitemap module?? Now that we have this code, is that module obsolete?
Comment #31
colanWhenever the XML Sitemap Internationalization submodule (xmlsitemap_i18n) is enabled, sitemaps will now be created automatically for each language. This patch is the same as the previous one, except that I've added xmlsitemap_i18n_install().
Comment #32
colanBetter title.
Comment #33
Neograph734Colan, your patch seems to be working nice. There is one thing I am not completely sure about;
If I enable the patched module while i18n is configured and in place, there are two sitemaps created for the english (default language). One named English and one named Default. The sitemaps for the other languages are fine.
Though this seems harmless and one of both can easily be deleted, it might be causing problems when the system tries to write the same file twice.
When I changed the i18n default language, the sitemap default language followed as expected. Therefor I suppose we should attempt to remove the default language, rather then to prevent the English (or other language) from being created. If one was to change the i18n default language later the same problem would occur with duplicate languages and English would even be missing.
You think you could add that to the patch?
Comment #34
colanAsk and you shall receive! Added a DB call to delete the default sitemap so it doesn't cause any confusion. It didn't seem to conflict with the new default language sitemap, but I agree, it's better to remove it.
Comment #35
das-peter CreditAttribution: das-peter commentedI think this looks pretty good now.
Just gave it another visual review and just found some minor coding style nit-picks.
Patch updated.
As I'm one of the people fiddling with the patch I probably shouldn't RTBC this :)
Comment #36
colanThanks das-peter. I noticed those, but forgot to fix them. I better not RTBC this either. :)
For anyone testing this, all you should have to do is:
Comment #37
Dave ReidSome overall review:
Comment #38
Neograph734Dave, pleaese be aware that though there is some overlap, entity translation is no replacement for i18n as stated on the module page. It is just another way of translating content. Language selectors and other aspects of i18n are still required to actually use entity translation. So I assume the i18n requirement is not much of an issue.
The other points are worth thinking about.
Comment #39
colanTo make it clear that xmlsitemap_i18n isn't only for the i18n module (I was confused about that myself when I first got into this issue), how about if we change the module description from Enables multilingual XML sitemaps to Enables XML sitemaps for multiple languages via the Locale module, used by Internationalization and Entity Translation.
I'm fine with moving this stuff into the base module - not sure why it was split off in the first place.
Comment #40
Dave ReidSimple, Entity Translation didn't exist yet. And without i18n there was no way to only have certain language content on certain domains, and not all content always on every domain.
Comment #41
MXTXML_sitemap_internationalization submodule should not be mandatory.
I'm not using it in my use case (see #18 and #19).
Comment #42
nlambert CreditAttribution: nlambert as a volunteer commented#35 works for me
Maybe out of scope for this issue, but one thing that seems to be missing is a way to add a language neutral sitemap that could point to language specific sitemaps. Or maybe the only way to do this is to actually put a sitemap.xml in the Drupal root.
E.g.:
/sitemap.xml # With links to language specific sitemaps:
/fr/sitemap.xml
/pt/sitemap.xml
/en/sitemap.xml
...
Comment #43
vimokkhadipa CreditAttribution: vimokkhadipa as a volunteer commented#35 works for me too
I applied the patch # 35, and it worked perfectly.
xmlsitemap Versión: 7.x-2.2+3-dev
Comment #44
pipicom CreditAttribution: pipicom commented#35 works for me also
xmlsitemap version: 7.x-2.2
Comment #45
sergei_brill CreditAttribution: sergei_brill commentedThe patch works well for me except one thing. After I applied the patch, I tried to disable xmlsitemap_i18n and enable it again. I got below error message:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3QuYVMoAVDdMUmwuEdFhwSFxLtcBNDrxIy91p4VzGdY' for key 'PRIMARY'' in [error]
/home/sergei/web/tours/site/includes/database/database.inc:2171
Stack trace:
#0 /home/sergei/web/tours/site/includes/database/database.inc(2171): PDOStatement->execute(Array)
#1 /home/sergei/web/tours/site/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
#2 /home/sergei/web/tours/site/includes/database/mysql/query.inc(36): DatabaseConnection->query('INSERT INTO {xm...', Array, Array)
#3 /home/sergei/web/tours/site/sites/all/modules/contrib/xmlsitemap/xmlsitemap_i18n/xmlsitemap_i18n.install(35): InsertQuery_mysql->execute()
#4 [internal function]: xmlsitemap_i18n_install()
#5 /home/sergei/web/tours/site/includes/module.inc(905): call_user_func_array('xmlsitemap_i18n...', Array)
#6 /home/sergei/web/tours/site/includes/module.inc(477): module_invoke('xmlsitemap_i18n', 'install')
#7 /home/sergei/.composer/vendor/drush/drush/commands/core/drupal/environment_7.inc(143): module_enable(Array)
#8 /home/sergei/.composer/vendor/drush/drush/commands/pm/pm.drush.inc(1120): drush_module_enable(Array)
#9 [internal function]: drush_pm_enable('xmlsitemap_i18n')
#10 /home/sergei/.composer/vendor/drush/drush/includes/command.inc(359): call_user_func_array('drush_pm_enable', Array)
#11 /home/sergei/.composer/vendor/drush/drush/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#12 [internal function]: drush_command('xmlsitemap_i18n')
#13 /home/sergei/.composer/vendor/drush/drush/includes/command.inc(178): call_user_func_array('drush_command', Array)
#14 /home/sergei/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#15 /home/sergei/.composer/vendor/drush/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#16 /home/sergei/.composer/vendor/drush/drush/drush.php(11): drush_main()
#17 {main}
I guess hook_uninstall should be included to xmlsitemap_i18n.install to remove contexts?
Comment #46
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedWorked on the review comments in #37 to try to keep moving this forward :-) Attaching interdiff and patch, plus missing interdiff for #45 that was posted in between.
In details, response to the various points of #37 below:
Comment #47
sergei_brill CreditAttribution: sergei_brill commentedSmall fix for last patch
Comment #48
DeFr CreditAttribution: DeFr at Axess Open Web Services commented@sergei_brill: Thanks for that and sorry for that typo :-)
Comment #49
Sakhmed CreditAttribution: Sakhmed commentedI have two languages enabled on my site English and Russian. Have several nodes that were originally created in English and then translated into Russian. Applied patch #47. Patch has been applied smoothly. Have two sitemaps for Russian and English. I can see all translated nodes in English sitemap but no translated nodes in Russian sitemap.
Using xmlsitemap-7.x-2.2+3-dev
Update
By some reasons translated nodes show up in actual xml file located in public directory. They are not showing in the sitemap that is available for viewing via drupal admin interface
Comment #50
sergei_brill CreditAttribution: sergei_brill commented@Sakhmed Make sure you did database update (/update.php or drush updb). And try to rebuild sitemaps here /admin/config/search/xmlsitemap/rebuild
Comment #51
Kristen PolWorks great! Thanks for the hard work. I found one minor typo:
optionnal => optional
Comment #52
Kristen PolI found an issue where the sitemaps were not being updated via cron when entity translation was done but the source node was untouched. The sitemaps would only get updated correctly when running the rebuild links option manually. To reproduce this issue:
I have updated the patch from #47 and added some code to
xmlsitemap_i18n_query_xmlsitemap_generate_alter
that will check if entity_translation is enabled and, if so, will use the entity_translation table for the query to find the nodes that need to be rebuilt. This seems like the logical place to add it but, if there are other suggestions, let me know.I also fixed the minor typo noted in my previous comment (#51). Thanks!
Comment #53
phanosd CreditAttribution: phanosd at Tabs & Spaces commentedHey all,
Recently had the issue where only "source" language nodes would appear on my sitemap. Patch #35 fixed this for me.
I have since however come across an undocumented issuewherever I try to create a new taxonomy term, or add translation to ANY taxonomy. Using xmlsitemap: 7.x-2.2+3-dev patch #35, 6 languages enabled
*EDIT*
Went to sitemap xlm module and deselected "node" from inclusion in sitemap. Rebuild links, problem has disappeared.
Comment #54
PascalAnimateur CreditAttribution: PascalAnimateur commentedI just tested #52 and it adds the original URL of the (untranslated) page to the translated sitemap.
For example, I create the "Test page" in english (/en/pages/test-page) and translate it to french as "Page de test" (/fr/pages/page-de-test), and my french sitemap has /en/pages/test-page instead of /fr/pages/page-de-test
Any ideas?
Comment #55
PascalAnimateur CreditAttribution: PascalAnimateur commentedUpdate: It seems the check for
is_array($link['language'])
in functionxmlsitemap_node_node_update
always returns FALSE ... perhaps it should check for index 'languages', which is an array?Comment #56
PascalAnimateur CreditAttribution: PascalAnimateur commentedUpdate (again): It seems the problem is with the generation of the sitemap itself, not the individual links being inserted / updated in the xmlsitemap table.
By adding a language condition in function xmlsitemap_generate_chunk, my sitemaps only contain links in the proper language! (see line 175 in xmlsitemap.generate.inc)
Here's patch #52 re-rolled with this additional line...
Comment #57
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedThe _node_update and _taxonomy_term update do seems off, seems like I didn't convert them properly when switching to the 'languages' key in #46 ; sorry about that. Uploading a patch that fix that.
I think that explains part of the problem described in #52. Not sure about the query_alter introduced in there though: I see that they're a port of the strict mode below, but adding some node specific case to handle Entity Translation that aims to be fully generic seems unexpected.
I also think that this query_alter is the cause of the problem @PascalAnimateur encountered.
So, what I'm attaching is #47 + the typo fix mentionned in #50 + the fix to the update calls.
@Kristen Pol, @PascalAnimateur: Can you please test and confirm if this works for you ?
Comment #59
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedForgot to git add the latest change before creating patches…
That one should be better.
Comment #60
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedComment #61
chrisdarke42 CreditAttribution: chrisdarke42 at Hook 42 commented#35 works for me too, I tried #52 and #56 but they were generating extra entries in the sitemaps for the wrong languages. Admittedly, I have not tested the taxonomy issue but if you don't need that, #35 seems to be good
Comment #62
DeFr CreditAttribution: DeFr at Axess Open Web Services commented@chris.darke: Could you please try #59 ?
Comment #63
PascalAnimateur CreditAttribution: PascalAnimateur commented@DeFr: I tested your patch and the french sitemap entry is not created for the node translation when I create it from the original english node.
Adding the query condition from my patch probably won't fix that, as I don't see the 'fr' entry for that translation in the database.
Comment #64
DeFr CreditAttribution: DeFr at Axess Open Web Services commentedTook the time to really test the patch I'm attaching this time, and everything seems OK. Running cron after adding a translation makes the link appear in the correct sitemap, deleting the translation makes it disappear, tested for node and taxonomy term. Sorry for the obvious typo in the patch above.
@PascalAnimateur If you can please confirm, it'd be more than welcome :-)
Comment #65
PascalAnimateur CreditAttribution: PascalAnimateur commented@DeFr : Your patch works great for node content and taxonomy terms!
Marking this as RTBC, although more people should probably inspect / test this further.
Comment #66
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedYay! Patch #64 fixes xmlsitemaps with nodes and menus for my test site in 3 languages. Thx @DeFr
Comment #67
Neograph734Seems to be working for me as well. Two languages and both site maps contain what they should contain.
Thanks!
Comment #68
Langley CreditAttribution: Langley as a volunteer commentedThanks for the patch it works great, except when trying to add taxonomy to sitemaps. The patch contains
xmlsitemap_taxonomy_taxonomy_term_update($term);
which should probably be
xmlsitemap_taxonomy_term_update($term);
?
Comment #70
SkinHello,
with #64, after applying the patch and after running update.php I have this error if I try to rebuild the sitemaps:
If i try with #68 I'm unable to apply the patch:
Comment #71
vasikeThere is an update for the #64 patch.
It seems the previous patches do not do anything about about for languages for entities not yet translated having "Enable language fallback" option set.
So we have these pages available for other languages than source/original but they do not get in/out of sitemaps.
This update also includes the fix about using xmlsitemap_taxonomy_taxonomy_term_update($term) in xmlsitemap_taxonomy_xmlsitemap_process_taxonomy_term_links() (see #68).
Comment #72
SkinI reinstalled 7.x-2.x-dev and applied #64 and after #71, but now I don't see taxonomy terms in the localized sitemaps, they appear only in the main language.
Comment #73
joachim CreditAttribution: joachim commentedPatch works great, though existing nodes that aren't showing in the sitemap aren't fixed by this until they've been edited.
Comment #74
jurgenhaasTested it and it works fine for me. In terms of updating all nodes, I have written a simple drush command doing this:
Comment #75
joachim CreditAttribution: joachim commentedCool! I hadn't managed to work out the right API to call in this module to update its data.
Though that's not going to scale for large sites. Ideally, it should be a hook_update_N() which uses the batch functionality to process the nodes in chunks.
Also, we could do to process only the nodes that need it maybe? I reckon this should give us them:
That's all the nodes that have a translation in addition to their source language.
Comment #76
sergei_brill CreditAttribution: sergei_brill commentedThe last patch works great. But I needed to add an additional option for my case. I have original site in English and localized version of the site for Australia. On the site I have main content type which references to other content type (multiple entityreference field). Nodes of the second content type have no own pages (at least users don't see them). I don't want to translate each item of the second content type, but I don't want to show all items of first content type on AU version and don't want add them to sitemap.xml. Also I don't want translate bean blocks on the AU version. So, I need Language fallback to be enabled, but I don't want add untranslated content to sitemap.xml. Therefore I added additional variable xmlsitemap_language_fallback which could be configured on xmlsitemap settings page.
Comment #77
sergei_brill CreditAttribution: sergei_brill commentedComment #78
DuneBLPatch 71 doesn't work for me... after applying it, I get errors when rebuilding the map
Comment #79
jsacksick CreditAttribution: jsacksick as a volunteer commentedI applied the patch #76 and it seems to work pretty well.
@DuneBL you need to run the database updates.
Comment #80
aschiwi CreditAttribution: aschiwi at undpaul commentedI successfully used the patch in #76. I have two languages enabled and add a few node types and vocabularies to the sitemap. There are about 200 entries per sitemap, so it's quite a small use case.
Thanks to everyone who helped with this patch <3
Comment #81
DuneBL@jsacksick Thanks for the tip!
This time I have used the #76 patch and didn't got the errors.
Unfortunately, the sitemap is only made by the nodes in the original language, not the translated ones.
An example is better:
Node1: Created in FR, translated (field translation) in NL
=>
/fr/node1
Will show up in the FR Sitemap but/nl/node1
will not appears in the NL SitemapThe opposite is also true
Node2: Created in NL, translated in FR
=>
/fr/node2
Will NOT shows up in the FR Sitemap but/nl/node2
will appears in the NL SitemapComment #82
Yazzbe CreditAttribution: Yazzbe commentedI successfully applied patch #76 against version 2.3
PS: applying the patch manually was a pain. Hope to see this fix committed in a next release or so.
To me this looks RTBC.
Comment #83
suit4 CreditAttribution: suit4 commentedAfter upgrading a page (with entity translations) to the xmlsitemap 7.x-2.3, I got errors editing and resaving nodes.
Error message was:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '272-node-en' for key 'PRIMARY': UPDATE {xmlsitemap} SET subtype=:db_update_placeholder_0, loc=:db_update_placeholder_1, language=:db_update_placeholder_2, access=:db_update_placeholder_3, status=:db_update_placeholder_4, status_override=:db_update_placeholder_5, lastmod=:db_update_placeholder_6, priority=:db_update_placeholder_7, priority_override=:db_update_placeholder_8, changefreq=:db_update_placeholder_9, changecount=:db_update_placeholder_10 WHERE (type = :db_condition_placeholder_0) AND (id = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => product [:db_update_placeholder_1] => node/272 [:db_update_placeholder_2] => en [:db_update_placeholder_3] => 1 [:db_update_placeholder_4] => 1 [:db_update_placeholder_5] => 0 [:db_update_placeholder_6] => 1464261898 [:db_update_placeholder_7] => 0.5 [:db_update_placeholder_8] => 0 [:db_update_placeholder_9] => 0 [:db_update_placeholder_10] => 0 [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 272 ) in drupal_write_record() (line 7336 of /var/www/vhosts/olfasense.com/httpdocs/includes/common.inc).
Like yazzybe I applied patch #76 against 7.x-2.3 which fixed the constraint problem.
Applying the patch was easy using
patch -p 1 < add_support_for_entity_translation-1481798-76.patch
Comment #84
othermachines CreditAttribution: othermachines commented#76 works well for me, thanks very much. Like @sergei_brill, I also don't want untranslated content added, so I'm pleased to have this additional setting.
After applying the patch be sure to run update,php (or drush updb).
Comment #85
milopca CreditAttribution: milopca at Òmada Interactiva commentedComment #86
milopca CreditAttribution: milopca at Òmada Interactiva commentedComment #87
d.sibaud CreditAttribution: d.sibaud commented#76 works like a charm, good for a commit
Comment #88
jamsilver CreditAttribution: jamsilver commented#76 works well
Comment #90
kalistos CreditAttribution: kalistos commentedI tried patch #76 and found some problems with it.
Disabling "This translation is published" flag for some translation doesn't remove node from Xmlsitemap with cache clearing.
So I have updated patch and interdiff.
Comment #91
kalistos CreditAttribution: kalistos commentedComment #92
gonssalJust tested #90 and everything seems to work fine. Update hook for PK worked too.
Drupal Commerce site with Entity Translation and fairly big number of products and related taxonomies. Indexed pages, blog posts, menu items and of course, products.
Moving to RTBC again.
Comment #93
kalistos CreditAttribution: kalistos commentedI have found that my previous patch doesn't work correctly with programmaticaly update. Source of this issue is in function xmlsitemap_link_load from function xmlsitemap_node_create_link must take $language variable also, if we need to add entity translation support by correct way. So I think we need to rework all places using xmlsitemap_link_load function with adding it.
But now I'm uploading patch that fixes this issue, and it looks it works correctly. But it isn't the best way.
Comment #95
candelas CreditAttribution: candelas as a volunteer commentedPatch #76 works perfect. Thanks a lot. I have uninstalled xmlsitemap, apply the patch and then install and configure. Now I have the maps in 4 languages using the node and menus modules.
Comment #96
SkinAny news? Is this bug still present?
Comment #97
saile CreditAttribution: saile as a volunteer commentedTried the patches but when rebuilding the sitemap I get mysql contraint errors
Er is een AJAX HTTP fout opgetreden. HTTP-resultaatcode: 500 Debug informatie volgt. Pad: /batch?id=297&op=do Statustekst: Service unavailable (with message) Antwoordtekst: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '23636-node' for key 'PRIMARY': INSERT INTO {xmlsitemap} (id, type, subtype, loc, language, access, status, status_override, lastmod, priority, priority_override, changefreq, changecount) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array ( [:db_insert_placeholder_0] => 23636 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => veld [:db_insert_placeholder_3] => node/23636 [:db_insert_placeholder_4] => fr [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => 0 [:db_insert_placeholder_8] => 1483980082 [:db_insert_placeholder_9] => 0.5 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 0 [:db_insert_placeholder_12] => 0 ) in drupal_write_record() (regel 7376 van /var/www/***/includes/common.inc).
Comment #98
jovial_prash CreditAttribution: jovial_prash commented#76 is working fine.
Please follow steps given below so as to create xmlsitemaps for multiple enabled languages separately.
1. Apply the patch.
2. To fix PDOException issue please run 'xmlsitemap_update_7204' hook_update.
2. enable 'xmlsitemap_i18n' module.
3. this will create lists of multiple sitemaps (depending on number of languages of the site) at XMLSITEMAP configuration page. If it fails to create on its own then you can add XMLSITEMAPS on your own in multiple enabled languages.
4. Edit required content 'include xml sitemap and save'.
5. refresh sitemap config page-----you will get those edited content (number) in links column.
6. sitemap links will go to 404 initially to fix that 'edit and save again those sitemaps'.
7. xml sitemaps should work now.
Comment #99
jovial_prash CreditAttribution: jovial_prash commentedComment #100
ThuleNB CreditAttribution: ThuleNB commentedAre there any plans to committ this patch soon?
Comment #101
fmmribeiro CreditAttribution: fmmribeiro commentedi used patch #90 but i found problem.
If I need a specific setting for a node, the setting doesn't get saved.
Comment #102
Neograph734This should not have been marked as RTBC. From #93 we already knew there were still issues with the proposed patch in #90 and the newer patch fails testing.
Reverting to needs work. The patch is not yet complete.
Comment #103
dev.patrick CreditAttribution: dev.patrick at TATA Consultancy Services for Pfizer, Inc. commentedTried #76 and this seems to resolve issue. Any plans to commit this patch?
Comment #104
cluke009 CreditAttribution: cluke009 commentedTried the #93 patch, ran updates and it worked for me. This on a fairly complex production site and testing went smoothly. What exactly is holding up this patch?
Comment #105
alexei.orlov CreditAttribution: alexei.orlov commented#90 or #93 works fine for me, except for vocabularies with 'Localize' translation mode: links from these kind of vocabularies are no further generated. Not applying the patch changes to xmlsitemap_taxonomy.module make it works again. I guess that changes to this module should check the translation mode of the vocabularies...
Comment #106
bramvandenbulcke CreditAttribution: bramvandenbulcke commentedI have been following this thread for about two years, waiting for a final patch. Also, it seems the Node Translation XML sitemap module (https://www.drupal.org/project/node_translation_sitemap) stopped being further developed because this functionality would be merged into the XML Sitemap module: https://www.drupal.org/node/2220641.
Patch #93 is working fine, one sitemap with almost all the pages and articles. Only issue I'm seeing at the moment is the frontpage, which has only been added in the main language. Normally, when I use XML sitemap I have to add View pages with the XML Sitemap custom submodule. Adding a View page with Entity Translation is not possible, because the node id has already been added in another language. These two are the same problem I suppose: the error shown on the XML Sitemap custom screen is "There is already an existing link in the sitemap with the path node/[nid]."
But anyway: thanks for all the effort put into the patches.
Comment #107
pavel.zheldak CreditAttribution: pavel.zheldak at Myplanet commentedMake add_support_for_entity_translation-1481798-90.patch compatible with patch indroduced in https://www.drupal.org/node/1670086 for rel="alternate" suport.
Comment #108
ciss CreditAttribution: ciss at yousign GmbH commented@pavel.zheldak Could you please provide an interdiff for your changes?
Comment #109
ciss CreditAttribution: ciss at yousign GmbH commentedThis is a reroll of #93, using a 3way merge against ffe35e1. I'm not sure what the point of #107 was (given that it was done for an older patch), so i hid the patch to minimize confusion.
Outstanding issues according to previous comments:
Setting to Needs Review to trigger tests.
Comment #111
attiks CreditAttribution: attiks at Attiks commentedApplied patch and enabled "xmlsitemap_i18n xmlsitemap_node xmlsitemap" works well, didn't test other sub modules
Comment #112
Nchase CreditAttribution: Nchase as a volunteer commented#109 works for me but still doesn't solve the hreflang issue. Instead of heaving a sitemap for each language there should be one with hreflang, which is then in accordance with Google. There is effort put into enabling hreflang: https://www.drupal.org/project/xmlsitemap/issues/1670086
Comment #113
fprevos2 CreditAttribution: fprevos2 commentedI'm having an issue with some of our sites. I'm not sure if it because we are using field translation or if we have some data issue but it does not seem to detect the proper language. When I have the option "Include links to untranslated entities to localized sitemaps" checked, the xmlsitemap tables contain content for 'und', 'en' and 'fr'. But the content that is mark has 'und' is duplicate from 'en' and 'fr' so it displays as duplicate on the xml sitemap. When the option "Include links to untranslated entities to localized sitemaps" checked, the xmlsitemap tables contain content for 'und' and 'fr' only. The content that is mark has 'und' is duplicate from the 'fr' and again display as duplicate content on the French xml sitemap. Since only the 'und' is displayed on the English xml sitemap, there is no duplicate there.
Comment #114
fprevos2 CreditAttribution: fprevos2 commentedI wrote a patch to add another option in the admin menu to exclude the language neutral ('und') from being in the resulting xmlsitemap (when translation is enable for that entity). It seems to fix my issue with duplicate content when the default language is set to Language neutral but translation exist.
Comment #115
pifagorTest fail
Comment #116
marco-sPatch #114 works for me with the current dev version (dev-2.x e47457f).
But there's a small issue in the node update hook. It isn't possible to set a custom sitemap status (inclusion), because the link bundle status is always 1. I've updated the patch accordingly.
Comment #117
drupalfan2 CreditAttribution: drupalfan2 as a volunteer commentedIs this patch still necessary for latest Drupal 7 version? I am using #76.
Comment #118
mdixoncm CreditAttribution: mdixoncm at ComputerMinds commentedI've rolled the patch from 76 against the latest 2.4 release (the security release that was out last night). It has a minor change to how node updates are handled, in that it handles the processing on a queue rather than synchronously in the hook_node_update().
Comment #119
cmseasy CreditAttribution: cmseasy commentedI am following this issue. What are the point(s) keeping the patches (latest #118) from status 'Needs review'?
Comment #120
othermachines CreditAttribution: othermachines commented@mdixoncm - Which patch did you re-roll? Is that #109?
Comment #121
drupalfan2 CreditAttribution: drupalfan2 as a volunteer commentedCan not apply patch #76 on newest version 7.x-2.4 .
Comment #122
othermachines CreditAttribution: othermachines commented@drupalfan2 - Read the latest comments and try the patch in #118. I believe it's a re-roll of #76 (although @mdixoncm should confirm).
Comment #123
mdixoncm CreditAttribution: mdixoncm at ComputerMinds commentedSorry, yes I could have been clearer couldn’t I :)
It’s a re-roll of 76 - which we have been using on a few sites now for some time - had a mild panic this morning when I realised it didn’t apply to the latest release :)
Comment #124
othermachines CreditAttribution: othermachines commented@mdixoncm - Well, I appreciate you doing that! Would you mind clarifying that in your comment (with the patch)? I'm sure there will be more folks coming here in search of your patch, and it might make it easier on them.
Comment #125
ciss CreditAttribution: ciss as a volunteer commented@mdixoncm Why did you reroll #76 instead of #109? Since #76 several issues have been mentioned that aren't covered by #76.
@fprevos2 and @marco-s: Can you please add interdiffs for your patches? In general, any patch that introduces functional changes should be accompanied by an interdiff.
@all If you reroll older patches just for the sake of having them still apply, please take care to hide them from the file list so that future work is not accidentally based on them.
Comment #126
mdixoncm CreditAttribution: mdixoncm at ComputerMinds commented@ciss - because we have been using the patch in 76 for a long time, and I needed to get the security release out by 6am, so I just went with what we knew ... figured it might help someone out so posted here :)
Comment #127
othermachines CreditAttribution: othermachines commented@ciss - If you asked for a show of hands, I'll bet a whole lot of the 93 followers of this issue are still using #76 since it stood for several months before any problems were detected. In the meantime, I think a re-roll of #76 is helpful while newer patches are awaiting review, but it should be clear that that is what it is.
Good call. And thanks for your efforts in trying to get things back on track. :)
Comment #128
zread CreditAttribution: zread commentedHere's a reroll of patch #116 against the latest DEV revision (commit 11b7c8ac475f9d1a186894956f01ed3e368d6707).
The patch includes a fix from https://www.drupal.org/project/xmlsitemap/issues/2987673, without which the sitemap links don't generate properly for languages.
Comment #129
orlando.thoenyI rerolled the patch #128 against the latest dev (2.x-dev#99dc2e6) version, that includes a critical bugfix:
TypeError: Argument 1 passed to xmlsitemap_node_create_link() must be an instance of stdClass, boolean given
(https://www.drupal.org/project/xmlsitemap/issues/2986847)
Comment #130
othermachines CreditAttribution: othermachines commented---------
Edit: Don't use this patch and interdiff! Refer to #131.
---------
Another re-roll of #116 against latest -dev. It removes a fix already committed in #2987673-5: Sitemap is not language aware (the fix mentioned in #128). The re-roll in #129 was missing a new file.
I am also adding an interdiff against #76 manually applied against -dev since it is still widely used.
I am going to *attempt* to outline the changes since then...
Changes since #76:
There's probably more. Feel free to jump in.
Improvement needed:
xmlsitemap_node/xmlsitemap_node.module line 39
$bundle_info
is superfluous here.$link_status
used to point to(int) $bundle_info['status'];
due to a change in #93 but was reverted (I think) in #116.Next steps
1. Improve this patch
2. Review and fix "Outstanding issues" from #109
3. Test
Setting to Needs Review for testbot.
Comment #131
othermachines CreditAttribution: othermachines commentedWeird. I had previously uploaded the files before I'd discovered the missing xmlsitemap_i18n.install from #129. Even though I hit "remove" on those files , apparently d.o. thinks they are the same. Let's see if renaming the files helps.
Comment #136
phjouFor me, the last patch does not apply on the dev branch.
I was using the patch #90, but the security release has broken all the patches. The function xmlsitemap_node_cron has been totally changed.
Comment #137
phjouUpdated the patch for the latest commit on the branch dev: 046c34f1e192539c69becab69c5683f79928dc60
I can do an interdiff if needed but I don't know based on what because no patch work anymore
Comment #138
zread CreditAttribution: zread commentedI've tested patch #137 against 7.x-2.5 (aka 046c34f) and it seems to run fine on our end. It just needs to be adjusted to not fail the module's functional test.
Comment #139
hctomI just also applied the patch from #137 and it applies cleanly... but I get errors during cron runs where the
xmlsitemap
gets updated;As you can see there is always
0
used for the langcode, which results those integrity constraint violations. I'll try to see if there is something I can do to fix this.Comment #140
hctom@phjou .. just one more question: Did you choose the patch form #90 for your reroll? Would be nice to have that information, to see what is really used now. Perhaps some maintainer should also take a look at this issue to clean up patches that were developed in different directions, which makes this issue quite unresolvable right now.
Comment #141
zread CreditAttribution: zread commented@hctom Based on a diff comparison, #137 is a direct reroll of patch #131.
Comment #142
hctom@zread thanx for the info. That's good, so we don't update outdated patches anymore ;)
I also found the problem with the patch that created the errors outlined in #139: The return value differed for
xmlsitemap_get_entity_languages()
in case the default language was returned.Default language was returned this way:
But available translations are returned this way:
So attached is a patch (based on patch from #137) that fixes this issue and returns the default language as a keyed array with status as value, too.
Comment #143
hctomSo lets get this reviewed, but keep the "Next steps" section of #130 in mind for this.
Comment #144
zread CreditAttribution: zread commented+1 for patch #142
Comment #145
ThuleNB CreditAttribution: ThuleNB commentedPatch 142 works for me too.
Comment #146
saurabh-chugh CreditAttribution: saurabh-chugh as a volunteer and at TATA Consultancy Services commentedpatch #142 works +1
Comment #147
mistrytheory CreditAttribution: mistrytheory commentedPatch #142 isn't working for me. I'm seeing a significant drop in links when applying the patch locally, compared to what we have on our production site. I can't seem to see any immediate errors appearing either.
Comment #148
zread CreditAttribution: zread commented@mistrytheory: Can you please provide more information? Like what version of xmlsitemap were you running before & with what patch? Have you ensured that all xmlsitemap-related Cron jobs have ran? (This is a fundamental difference with older versions of xmlsitemap, which could explain why you aren't immediately seeing as many links.)
Comment #149
hctom@mistrytheory Can you please clarify/answer the questions asked by zread? As you are the only one so far who experiences problems with the patch, it would be nice to help us find potential problems.
By the way: when we applied the patch, we also had a drop in links locally. But after forcing a rebuild of all sitemap links via the admin UI and running the cron a lot of times with regenerating all cached sitemap files afterwards, we had exactly the same number of links as before.
Comment #150
mistrytheory CreditAttribution: mistrytheory commentedApologies, I only got around to seeing the above comments now.
I tried this on 7.x-2.5 (and I believe for 4 as well).
@hctom we did something similar as well whilst testing; updating the cached files and rebuilding the sitemap, but no luck.
The only thing we hadn't run is the cron job, maybe that'll fix the issue? I'll endeavour to look into this, this week.
Comment #151
sabbaghian CreditAttribution: sabbaghian commentedPatch #142 works for me. Of course after running cron.
Comment #152
zread CreditAttribution: zread commentedMarking this as RTBC.
@mistrytheory: You absolutely have to run Cron. It's a major change introduced in xmlsitemap itself since version 2.4/2.5.
Comment #153
Ant.on CreditAttribution: Ant.on commented@zread: I updated the xmlsitemap module, implemented the #142 patch , ran cron, cleared my caches, and I still am not seeing the translated URLs in my sitemap. This is a broad question, but do you or anyone else have any ideas on what I could have missed? I double checked the diffs for my patch (Had to do it manually) and they are the same, so nothing in the patch was missed.
Any thoughts are super appreciated.
Comment #154
hctom@Ant.on: Did you follow my comment #149? We really had to rebuild all links via UI, run cron several times and regenerate cached sitemap files and then everything was okay again.
Comment #155
bojan_dev CreditAttribution: bojan_dev commentedI was getting the following error on updb: Cannot add primary key to xmlsitemap : primary key already exists.
The language index should be dropped before it get's added as primary key, this has been covered now in the #155 patch.
Comment #157
bojan_dev CreditAttribution: bojan_dev commentedUpdated array syntax to support PHP 5.3.
Comment #158
zread CreditAttribution: zread commented@bojan_dev: Your patch removes xmlsitemap_i18n/xmlsitemap_i18n.install. Please fix this and ideally attach an interdiff between yours & patch #142.
Comment #159
bojan_dev CreditAttribution: bojan_dev commented@zread: Thanks for your input, fixed the patch and added an interdiff.
Comment #160
hctom@bojan_dev: I just looked into your new patch and I think there is something wrong with it. Just open up the patch from #142 and your patch and you will see, yours has a lot more changes in it, that are not in your interdiff. Can you please check and provide another patch? I hide your files in the meantime, so nobody uses them as there are definitely some problems with them. Thanx.
Comment #161
bojan_dev CreditAttribution: bojan_dev commented@hctom: Indeed there was something weird going on, I have double checked it now, hopefully it's now oke :)
Comment #162
ThuleNB CreditAttribution: ThuleNB commentedAgainst which version of the module should I apply the patch?
Comment #163
iamfredrik CreditAttribution: iamfredrik commentedPatch #142 gets applied to the latest dev without errors, but it removed seven links. The sitemap had 128 links before and now only 121.
Patches #159 and #161 causes the following error:
Fatal error: Cannot redeclare xmlsitemap_update_7204() (previously declared in /sites/all/modules/contrib/xmlsitemap/xmlsitemap.install:574) in /sites/all/modules/contrib/xmlsitemap/xmlsitemap.install on line 585
Comment #164
bojan_dev CreditAttribution: bojan_dev commentedI have rerolled the patch to the latest dev, I guess the update_7204 has been added in the meanwhile, so I have renamed the update to 7205.
Comment #165
ThuleNB CreditAttribution: ThuleNB commentedI tried patch #142 with the latest dev version but my site breaks. Can somebody send me a patched version, please? I don't find the mistake.
Comment #166
Ant.on CreditAttribution: Ant.on commented@hctom,
Sorry for not replying sooner. The issue I was trying to implement this patch for isn't going to be used, however your suggestion worked!
I re-ran cron/cleared cache/rebuilt links enough times that it seemed to work!
Thanks!
Comment #167
therocket_gr CreditAttribution: therocket_gr commentedthanks for patch #164.. works fine
Comment #168
guardian87 CreditAttribution: guardian87 commentedHi all,
Can someone tell me which patch works for the current 2.6 release of xmlsitemap?
So not the latest dev, but the current 2.6 version.
Many thanks
Comment #169
steva1982 CreditAttribution: steva1982 commentedHi,
Any news?
Thank you.
Ste
Comment #170
litzastark CreditAttribution: litzastark commentedConfirming that patch #164 worked smoothly against version 2.6. Thank you!
Comment #171
PhilYAlso confirming patch #164 works using Drupal 7.64 and xmlsitemap 2.6
I had to disable, uninstall and reinstall all xmlsitemap modules to have the patch working (xmlsitemap, xmlsitemap_i18n and xmlsitemap_node)...
Thank you guys for you work.
Comment #172
sergeimalyshev CreditAttribution: sergeimalyshev commentedUsing the last patch I can't update the xmlsitemap status of the taxonomy terms.
I've added small fix to patch #164.
Comment #173
sergeimalyshev CreditAttribution: sergeimalyshev commentedComment #174
ykyuen CreditAttribution: ykyuen as a volunteer commented#172 works. thanks
Comment #175
ciss CreditAttribution: ciss as a volunteer commentedAs a help for reviewers, here is the current patch history from #109 onward. Excerpts are taken from #172.
Introduced the following code:
Introduced the following code:
Possibly a faulty reroll, moves changes in xmlsitemap_node_node_update() to xmlsitemap_node_cron().
Faulty reroll, drops entire xmlsitemap_i18n.install.
Reroll, restores xmlsitemap_i18n.install.
Reroll (to match refactoring), moves the following code:
Changes to the following code:
Interdiff:
Adds the following code:
Applies change in #116, made for node, to taxonomy.
Comment #176
james.williams CreditAttribution: james.williams at ComputerMinds commentedThanks for that great summary @ciss!
I'm using the patch from comment 172, which looks to be working reasonably so far.
However, if the 'Include links to untranslated entities to localized sitemaps' setting (
xmlsitemap_language_fallback
) is unticked, links to even published translations (including the original content) can end up removed from the sitemap. This is because calls toxmlsitemap_node_create_link()
, which are supposed to get existing settings viaxmlsitemap_link_load()
, are not filtered by language and so just pick the first record from the {xmlsitemap} table. If that happens to be an unpublished translation, then you're out of luck - the record for your other translation will be updated with a zero status when cron comes along to update the access field for the record.Presumably the same issue applies with xmlsitemap_taxonomy (etc?), though I'm not using that.
Given that we're adding language as a primary key to the xmlsitemap table, I think we need to start filtering by language everywhere possible too, to avoid this scenario. I'm out of time for today... hopefully I can submit a patch tomorrow!
Comment #177
james.williams CreditAttribution: james.williams at ComputerMinds commentedHere we are - this patch (built on top of patch 172, which is working for me otherwise) tries to ensure only the link record for the appropriate language is ever dealt with, rather than just loading up the first one. This allows the status to be different for each entity translation. Note that the rest of the settings (priority etc) are still kept the same across all languages. I haven't run the actual tests yet, let's see what happens...!
Comment #178
othermachines CreditAttribution: othermachines commentedDeleted unhelpful comment. Sorry for the noise. :-/
Comment #179
james.williams CreditAttribution: james.williams at ComputerMinds commented@othermachines - that code is part of
xmlsitemap_get_entity_languages()
, which returns language keys, all mapped to 0 or 1. Perhaps the doxygen for that function should be improved as it's not accurate to what the function actually does.Comment #180
othermachines CreditAttribution: othermachines commented@james.williams - Yes, sorry about that. I was attempting to track down a particular issue I am having and didn't realize that function had been modified to that extent.
My issue is that, if a node is originally set to language neutral, then later translated, the language neutral entry isn't updated in the xmlsitemap table. The most critical side effect of this is, if the node is later unpublished, the link will still appear in the sitemap.
A simplified overview (active languages are 'en' and 'sv'):
1. Page is created as language neutral
xmlsitemap table:
en - access 1, status 0
sv - access 1, status 0
und - access 1, status 1
2. Page is switched to English (en)
xmlsitemap table:
en - access 1, status 1
sv - access 1, status 0
und - access 1, status 1
3. Page is unpublished.
xmlsitemap table:
en - access 0, status 1
sv - access 0, status 0
und - access 1, status 1
I think the issue might be that
xmlsitemap_get_entity_languages()
should always return LANGUAGE_NONE ('und') as part of the result set (and access/status set accordingly), not just when the entity is untranslated. Not sure, though.I'd sure appreciate your thoughts!
We are using the latest -dev of this module + the latest patch in #177.
Language fallback is enabled.
The two settings provided by this patch are disabled.
We don't use i18n.
Comment #181
james.williams CreditAttribution: james.williams at ComputerMinds commentedSure - so language neutral content should not be translated, by definition. If content is 'neutral' with respect to language, the whole point of that is that it should not be different between languages. I have seen corrupted content that has got into a bad state, with a 'neutral' translation alongside translations in 'actual' languages, but that should be totally unsupported. Drupal core and key multilingual modules ill also struggle if data ever gets into an incoherent state like that anyway.
So I don't think there's a problem there?
That said, it's often possible to change the language of content - so if it is originally created as language neutral, it could be changed to English/etc, and then truly translated into another language. So if you're testing, that might be a scenario to check (I haven't looked at the code recently). I'd hope we already cope with that, because the language neutral version should be removed at the point of first changing the content to English/etc.
Comment #182
othermachines CreditAttribution: othermachines commentedThanks!
I am testing with fresh content. It occurs when a node is switched from 'language neutral' to English (or other language) before being translated. I should have been more explicit about that in my description, but I'm not sure it matters.
And therein lies my problem. It is not removed, nor updated. In my tests, when the content is first created as language neutral,
xmlsitemap_get_entity_languages()
(provided by this patch) returns all active languages, plus 'und', and these rows get added to the table. When the content is updated, it only returns the active languages. Therefore (presumably) only those rows in the table are updated while 'und' is left in its original state. This causes both duplicate links as well as links to unpublished content in the generated sitemap.Anyway, I'll report back if I have any revelations. It's been awhile since I've had to look at this code, as well. I'm hoping someone more familiar with the patch might easily see the problem (and a fix). Thanks again -
Comment #183
joele75 CreditAttribution: joele75 commentedI hope this is not a question that's been asked elsewhere and that it's relevant to this discussion.
I have a site (running on 8.8) that is largely based off a default English locale - in that most (95%) of pages were created in English and translated into German where needed. There are also some pages that were created only in German and not translated to English. At the moment, the sitemap entries for the English site are only including the nodes/pages that are in English which is fine I believe. The German sitemap.xml contains just the homepage. Is this expected behaviour? I understand that the hreflang tags in each English page should point the searchbots to their German equivalent so 95% of the German site is currently covered but the German only pages do not appear to be getting added. It might be that I've taken a non-standard approach to this but it would be good to hear that and to know whether this is something that can be solved with this package or whether that is unlikely.
Comment #184
proweb.ua CreditAttribution: proweb.ua commented#172
when uninstalling module xmlsitemap_i18n this error
Comment #185
james.williams CreditAttribution: james.williams at ComputerMinds commentedThanks @proweb.ua - updated patch here.
Comment #186
aubergine2010 CreditAttribution: aubergine2010 commentedThis patch is not working for me, language neutral content is not added to any sitemap.
Comment #187
james.williams CreditAttribution: james.williams at ComputerMinds commented@aubergine2010 what do you have set for the 'Include links to untranslated entities to localized sitemaps' and 'Exclude links to language neutral entities to localized sitemaps' settings?
Are you in a place to be able to help diagnose why they're not appearing for you?
Language-neutral content is certainly handled by this patch; there are comments above discussing some specific scenarios around language neutral content, so it would be good to identify your scenario.
Comment #188
thomaswalther CreditAttribution: thomaswalther commentedSo is this module ready for multilanguage? No fix for this 7 version? Is this error still in 8.x-1.2?