Skip to content

fix: SEO image URL paths#129

Merged
gocanto merged 8 commits intomainfrom
gocanto/fix-image-directory-paths-for-seo-2025-10-10
Oct 10, 2025
Merged

fix: SEO image URL paths#129
gocanto merged 8 commits intomainfrom
gocanto/fix-image-directory-paths-for-seo-2025-10-10

Conversation

@gocanto
Copy link
Collaborator

@gocanto gocanto commented Oct 10, 2025

Summary

  • normalize generated SEO image paths to remove parent directory traversal segments
  • add regression test to ensure generated URLs point to the images directory

Testing

  • go test ./metal/cli/seo -run TestGeneratorPreparePostImageNormalizesRelativeURL -count=1 -v

https://chatgpt.com/codex/tasks/task_e_68e888915dc083338e9f7b9e8bafb7db

@gemini-code-assist
Copy link

Summary of Changes

Hello @gocanto, 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 addresses an issue where generated SEO image URLs could contain incorrect parent directory traversal segments, leading to broken links or improper indexing. By implementing a dedicated URL normalization function and integrating it into the image preparation logic, the change ensures that all SEO image paths are correctly formatted and consistently point to their intended locations, thereby improving the robustness and correctness of SEO-related image handling.

Highlights

  • URL Normalization: Introduced a new normalizeRelativeURL function to clean generated SEO image paths by removing parent directory traversal segments (e.g., ../) and leading slashes, ensuring valid relative URLs.
  • Regression Test: Added a comprehensive regression test, TestGeneratorPreparePostImageNormalizesRelativeURL, to validate that the preparePostImage function correctly normalizes URLs and that the generated URLs point to the intended images directory.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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.

@gocanto gocanto marked this pull request as draft October 10, 2025 04:26
@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gocanto/fix-image-directory-paths-for-seo-2025-10-10

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 aims to fix SEO image URL paths by normalizing them to remove parent directory traversal segments. The approach introduces a new normalizeRelativeURL function and a regression test.

My review focuses on the robustness and efficiency of the new normalization function. I've found that the current implementation has some edge case bugs and can be inefficient. I've suggested a more robust implementation for normalizeRelativeURL. Additionally, I've recommended adding a dedicated unit test for this new helper function to cover various edge cases and ensure its correctness independently.

@gocanto gocanto removed the codex label Oct 10, 2025
@gocanto gocanto changed the title Fix SEO image URL paths fix: SEO image URL paths Oct 10, 2025
@gocanto gocanto marked this pull request as ready for review October 10, 2025 06:43
@gocanto gocanto merged commit 5228587 into main Oct 10, 2025
3 checks passed
@gocanto gocanto deleted the gocanto/fix-image-directory-paths-for-seo-2025-10-10 branch October 10, 2025 06:43
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.

1 participant