Skip to content

Bugfix/small fixes adjusted#134

Merged
kaspars-ozols merged 13 commits intomasterfrom
bugfix/small-fixes-adjusted
Aug 14, 2025
Merged

Bugfix/small fixes adjusted#134
kaspars-ozols merged 13 commits intomasterfrom
bugfix/small-fixes-adjusted

Conversation

@kaspars-ozols
Copy link

No description provided.

Nikola117 and others added 7 commits January 16, 2025 10:26
# Conflicts:
#	src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml
Ensure the cache expiration time for sitemap data is always non-negative by applying a Math.Max check. This prevents potential errors caused by invalid configuration values.
Replaced `SitemapDataCacheExpirationInMinutes` with more specific `RealtimeCacheExpirationInMinutes` and `RealtimeCacheExpirationInMinutesGoogleBot`. Updated caching logic to use the new properties and revised README to reflect the changes in configuration.
The EnableLanguageDropDownInAdmin configuration property has been removed from the README and SitemapOptions class as it is no longer used. This simplifies the codebase and enhances maintainability by removing unnecessary fields.
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @kaspars-ozols, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new configuration options for sitemap caching, allowing for distinct cache expiration times for general requests and GoogleBot requests. It also removes an obsolete configuration setting and includes a minor bug fix related to URL processing, specifically enhancing the robustness of URL handling in the sitemap generation process.

Highlights

  • Sitemap Cache Configuration: Introduced RealtimeCacheExpirationInMinutes and RealtimeCacheExpirationInMinutesGoogleBot to allow granular control over sitemap cache durations.
  • Obsolete Setting Removal: The EnableLanguageDropDownInAdmin configuration option has been removed from the sitemap settings.
  • URL Utility Bug Fix: A potential IndexOutOfRangeException in the UrlFilter utility has been addressed by adding a null or whitespace check before processing URLs for trailing slashes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several small fixes and adjustments. It removes the EnableLanguageDropDownInAdmin option and adds new configuration for realtime sitemap cache expiration for regular users and Google Bot. The documentation in README.md is updated accordingly. A bug that could cause an exception when processing an empty URL in UrlFilter has been fixed. My review focuses on the updated caching logic in GetaSitemapController, where I've identified a potential issue with cache invalidation that could lead to serving stale sitemaps.

kaspars.ozols added 5 commits August 13, 2025 14:43
Replaced manual character checks with `string.EndsWith` and `string.StartsWith` for better readability and cleaner code. This improves maintainability and ensures consistency in URL manipulation logic.
Refactored the `SitemapCreateJob` to use a results tracking mechanism for individual sitemap generation and introduced error handling. Improved code readability, replaced string formatting with interpolation, and ensured clear logging of success or failure for each sitemap. Exceptions are now thrown if any generation process fails, providing more robust error reporting.
Added the content version key to the cache eviction policy to ensure cache invalidation occurs when content updates. This improves the accuracy of the sitemap data served to users.
Eliminated separate caching behavior for Googlebot by removing related code, configurations, and logic. The caching mechanism now uses a unified expiration setting for all users, improving simplicity and maintainability. The cache will be automatically invalidated in case any content gets published.
This change removes an extra blank line in the SitemapOptions configuration class to maintain consistent formatting and improve code readability. No functional changes were made.
@kaspars-ozols
Copy link
Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a number of small fixes and improvements. A key change is the removal of special caching logic for Google Bot in favor of a configurable absolute cache expiration for real-time sitemaps. This is a breaking change as it removes the EnableLanguageDropDownInAdmin option and introduces RealtimeCacheExpirationInMinutes. The scheduled job for sitemap generation has been improved to correctly report failures. The documentation has been updated to reflect these changes, although one example could be improved to better showcase the new functionality. Other changes include minor code style and readability improvements.

Updated the JSON example in the README to include the new `RealtimeCacheExpirationInMinutes` parameter. This provides better guidance on configuring cache expiration for real-time sitemaps.
@sonarqubecloud
Copy link

@kaspars-ozols
Copy link
Author

This PR is strongly inspired by #135

However, with some slight adjustments:

#104 - was fixed by adding EndsWith (otherwise tailing slash would not be added in case of empty string and that would not match the method name).
#84 - scrolling issue was fixed by wrapping iframe in the div + reusing Optimizely built-in styles to size it accordingly, dynamic iframe resizing via JS is no longer needed
#78 - was fixed by adding configuration option + setting up cache dependance on content versioning allowing to invalidate cache on content change
#112 - same as issue above

@kaspars-ozols kaspars-ozols merged commit 5eba1b3 into master Aug 14, 2025
6 checks passed
@kaspars-ozols kaspars-ozols deleted the bugfix/small-fixes-adjusted branch August 14, 2025 06:15
@kaspars-ozols kaspars-ozols added this to the 3.2.0 milestone Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants