Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gbyte.co created an issue. See original summary.

gbyte’s picture

Title: Allow choosing multiple sitemap variants per view display » Allow indexing a view display in multiple variants via UI
gbyte’s picture

Issue summary: View changes
WalkingDexter’s picture

Currently, the display extender settings have the following structure:

index: true
variant: default
priority: '0.5'
changefreq: ''
arguments:
  type: type
  title: title
max_links: 100

I think that to solve this issue, we can use the new structure:

variant1:
  index: true
  priority: '0.5'
  changefreq: ''
  arguments:
    type: type
    title: title
  max_links: 100
variant2:
  index: true
  priority: '0.3'
  changefreq: ''
  arguments:
    type: type
  max_links: 50
...

However, this will require changing the views.display_extender.simple_sitemap_display_extender schema. We also need a new implementation of the hook_update_N to change the structure of settings that are already saved.

gbyte’s picture

That's fine with me, I believe users of the module have gotten used to the constantly changing configuration/data structure. ;)

init90’s picture

Status: Active » Needs review
FileSize
8.42 KB

I've encountered with such case when worked with multi-domains sitemaps. I have a few views which display domain specified content, for every domain I have a separate sitemap variant. My purpose was to add a few variants to needed view in order to get view link for a different domains sitemaps.

Attached patch only supports multi-variants without ability add separate options per variant.

WalkingDexter’s picture

Status: Needs review » Needs work

@init90 thank you for contributing! However, I note that there is a significant problem in your patch - there is no way to set different settings for each sitemap variant. We need the structure described in #4.

init90’s picture

>However, I note that there is a significant problem in your patch - there is no way to set different settings for each sitemap variant.

Yes, my patch provides only a quick solution for multi variants support, without options per variant.

I agree that the concept described in comment #4 is more propper.

According to comment #4, I have a question about the UI part.
How it should look? Maybe fieldsets list, where every fieldset is separate sitemap variant?

WalkingDexter’s picture

FileSize
14.16 KB

According to comment #4, I have a question about the UI part.
How it should look? Maybe fieldsets list, where every fieldset is separate sitemap variant?

I think it should look like this:

UI screenshot

Separate form for each variant.

gbyte’s picture

Whatever you guys do, bear in mind, there can be 5000 variants, so it would make sense to at least hide them in a field set so they don't destroy the view layout or something.

init90’s picture

>I think it should look like this:

Looks good, thank you.

>Whatever you guys do, bear in mind, there can be 5000 variants, so it would make sense to at least hide them in a field set so they don't destroy the view layout or something.

Hard to imagine the case when needed 5000 sitemaps variants, nonetheless it's a good point and should be counted. Thanks!

gbyte’s picture

Hard to imagine the case when needed 5000 sitemaps variants, nonetheless it's a good point and should be counted.

Not too hard to imagine; originally the variants were created for a wholesaler that uses this module as an API feeding its product variants to shops. They have thousands of variants going on.

WalkingDexter’s picture

Whatever you guys do, bear in mind, there can be 5000 variants, so it would make sense to at least hide them in a field set so they don't destroy the view layout or something.

@gbyte.co, is the current UI adapted to this case? For example, on the node type edit page, in the "Simple XML Sitemap" block, each variant is a "details" element. If there are 5000 variants, it will look bad. In addition, most likely, the form will not be submitted due to the large number of elements (max_input_vars).

I'm not sure that we need to take this case into account, since the current UI is also not adapted for it.

gbyte’s picture

The variants however are hidden in a fieldset, so when editing the node type, the layout does not break. My concern is for the views edit page layout not to break when editing the view, which would be the case with hundreds of variants and the design proposed in #9.

paulmartin84’s picture

I've run into some issues where this is not working with multiple variants. It seems that we are destroying the view as soon as we get to a variant that the view doesn't index in to. I've removed that destroy code now and that seems to have fixed it for me at least.

paulmartin84’s picture

WalkingDexter’s picture

Status: Needs work » Needs review
FileSize
47.14 KB

Patch with solution. So far, no hook_update_N implementation. Will definitely work with a clean install of the module.

gbyte’s picture

@WalkingDexter good to hear from you. Wow quite a big patch, let's add the update hook and commit!

WalkingDexter’s picture

Status: Needs review » Needs work
WalkingDexter’s picture

WalkingDexter’s picture

@gbyte please note that I no longer have commit permissions.

  • gbyte committed 80f5a89 on 8.x-3.x authored by WalkingDexter
    Issue #3054239 by WalkingDexter, paulmartin84, init90, gbyte: Allow...
gbyte’s picture

Status: Needs review » Fixed

Thanks. The only improvement we could add on top is abstracting Drupal\simple_sitemap\Form\FormHelper::displayEntitySettings and using it to display the sitemap settings to avoid code duplication. But this is so low priority, I am happy to mark this as fixed.

@WalkingDexter Great work as always! If you feel you have the capacity to continue contributing, I'm happy to reinstate commiter access.

WalkingDexter’s picture

@gbyte I am glad to help :) Thanks, access will be useful. As before, I cannot guarantee that I will always have enough time to work on the module.

gbyte’s picture

@WalkingDexter Restored write access to vcs, but it may be removed after a very long period of idleness.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.