According to the #3015295: Integrate into 3.x of simple_sitemap, I create this issue and attach a patch that adds support for the Views module.

Comments

WalkingDexter created an issue. See original summary.

gbyte’s picture

Category: Support request » Feature request
gbyte’s picture

Status: Needs review » Needs work

That's some quality code, thank you for contributing! This will be a great feature for 3.1 or later release. There are a few minor things that need to be addressed:

  • I believe EntityUrlGeneratorBase should be extended instead of UrlGeneratorBase in ViewsUrlGenerator so we do not need to duplicate generate() and getUrlVariants() code. We should be able to remove these two methods when inheriting from the right class.
  • Disabling views support in admin/config/search/simplesitemap/views should produce a warning and delete views sitemap data to be consistent with the Sitemap entities tab. Maybe we can link to the view displays, as getting the display link should not be difficult. Good idea by the way to implement this tab to have an overview of views that are indexed.
  • Building queue, then deleting an indexed view display and then regenerating throws an error about the display non existing in ViewsUrlGenerator::processDataSet. We need to check if that display exists.
  • If you are short on time, I can help with the above and some other minor things I found, however I would like you to write a couple of tests for the new functionality, as I do not have the use case for it and I believe my tests would suffer because of it.

Also if you would like to continue working on the module in a more permanent basis, I can grant maintainer status.

walkingdexter’s picture

  1. I thought about it while writing a patch, but I was embarrassed by a few things:
    - Views URLs are not associated with content entities.
    - Extending the EntityUrlGeneratorBase will result in the injection of unnecessary services. For example, the EntityHelper service.
    For the formation of Views URLs only two EntityUrlGeneratorBase methods are important - generate() and getAlternateUrlsForAllLanguages(). Do you think it is right to move these methods to UrlGeneratorBase?
  2. I agree, this moment needs some work.
  3. Yep, it needs to be fixed.
  4. Tests will be helpful. Any idea what we need to check with tests?

I will be glad to receive the maintainer status. However, I can not guarantee that I can find enough time to developing the module.

gbyte’s picture

1. This is a valid concern, however I believe Injecting these services is not a big problem as they are probably loaded anyway. Even if they cost additional resources, the code de-duplication makes it worthwhile.

4. We need at least one functional test testing the indexation of a view with arguments. The submodule's code is strongly tied to the main module making it vulnerable to any changes. So we need a functional test testing if view indexation works after any changes are made.
If you look into Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest, you will see the tests are mostly simple browser tests and not very extensive, but I've been trying to cover most functional aspects of the module.

I understand if you don't have much time for contrib work - neither do I. ;) But if you think you can be of help sometimes to answer in the issue queue or discuss some technicality with me, I think it's worth considering. I like your coding style and now you understand the module's internals well, this is why I asked. Your decision!

walkingdexter’s picture

I understand if you don't have much time for contrib work - neither do I. ;) But if you think you can be of help sometimes to answer in the issue queue or discuss some technicality with me, I think it's worth considering. I like your coding style and now you understand the module's internals well, this is why I asked. Your decision!

Well, I think it's worth a try :)

gbyte’s picture

You can push to the repo now. The views functionality needs its own feature branch until we have tests and 3.0 has been released. Cool to have you on board!

walkingdexter’s picture

@gbyte.co, I created a feature branch and made changes to it according to the above comments (see the commit log for details).

I have two questions:

  1. After disabling or removing the display extender, its settings are not removed from the view display. The Views module does not care about this. Should we directly remove the display extender settings from all displays after disabling the Views support?
  2. Do you think the current code in the feature branch is OK? Can we start writing tests?
walkingdexter’s picture

Status: Needs work » Needs review
Issue tags: +Needs tests
gbyte’s picture

Assigned: Unassigned » walkingdexter
Status: Needs review » Needs work
StatusFileSize
new31.73 KB

After some thinking, I recon the 'enable views support' does not make much sense, as the only thing this module does is adding support for views. In addition, it is confusing to have to enable the module and then into the settings to enable views support. I like the list of indexed views however. What do you think about removing the 'views support' button?

Also, there seems to be something off with the UI/js when indexing the view, see screenshot.

I feel good about the code, feel free to merge with develop branch any time. But I would feel much better with some tests. ;)

gbyte’s picture

walkingdexter’s picture

What do you think about removing the 'views support' button?

I agree, it is better to remove this option. After that, the "Sitemap views" page will display only the list of indexed displays.

Also, there seems to be something off with the UI/js when indexing the view, see screenshot.

I could not reproduce this problem in recent versions of Chrome and Firefox. Which browser are you using (version will also be helpful)? Are there any JavaScript errors?

I feel good about the code, feel free to merge with develop branch any time. But I would feel much better with some tests. ;)

Cool :)

gbyte’s picture

I could not reproduce this problem in recent versions of Chrome and Firefox. Which browser are you using (version will also be helpful)? Are there any JavaScript errors?

Don't worry about it as I could not reproduce it just now, maybe it was some browser error. It was Friefox 64.0.2 on Arch Linux.

dercheffe’s picture

There's already a views support module: https://www.drupal.org/project/simple_sitemap_views. Perhaps it can be merged/forked into this module?

walkingdexter’s picture

@dercheffe, this is already in progress :) I am the maintainer of the simple_sitemap_views module.

dercheffe’s picture

@WalkingDexter now I've seen the referenced issue, sorry :)

gbyte’s picture

Status: Needs work » Reviewed & tested by the community

@WalkingDexter I've pushed a couple of commits of mine to improve the integration and I am happy. Feel free to merge this into dev if you agree.

walkingdexter’s picture

@gbyte.co I want to add the following tests:

  1. Check availability of views links in the sitemap.
  2. Check the effectiveness of garbage collection.

If you think that these tests don't really matter now (we can add them later), then I agree to merge the changes into the dev branch.

gbyte’s picture

You can merge it and add the tests to dev afterwards. Would be nice to publish 3.1 with views support and xsl stylesheets soon. :)

walkingdexter’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests

Merged 3017271-views-support into 8.x-3.x.

Status: Fixed » Closed (fixed)

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