Skip to content

fix(docs): redirect integration sections to source - #3775

Open
lyydsheep wants to merge 1 commit into
googleapis:mainfrom
lyydsheep:fix/issue-3752-integration-redirect
Open

fix(docs): redirect integration sections to source#3775
lyydsheep wants to merge 1 commit into
googleapis:mainfrom
lyydsheep:fix/issue-3752-integration-redirect

Conversation

@lyydsheep

Copy link
Copy Markdown

Fixes #3752.

Integration sections that contain a source.md page now redirect their root URL to that source page. This applies globally through the shared Hugo section layout, so new integrations inherit the behavior automatically.

Validation:

  • Verified the Hugo template references the child source page and emits both a meta refresh and JavaScript fallback.
  • git diff --check passes.

@google-cla

google-cla Bot commented Aug 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lyydsheep
lyydsheep requested a review from a team as a code owner August 4, 2026 12:43

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

Copy link
Copy Markdown
Contributor

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 an automatic redirect for integration section pages to their corresponding "source" subpage within ".hugo/layouts/docs/section.html". The reviewer identified a potential Hugo build failure (nil pointer evaluation) that can occur if any page in ".Pages" does not have a physical file (where ".File" is nil). They provided a safer implementation that iterates through the pages, verifies ".File" is present, and avoids redundant index lookups.

Comment on lines +2 to +7
{{ $sourcePages := where .Pages "File.BaseFileName" "source" }}
{{ if and (hasPrefix .RelPermalink "/integrations/") (gt (len $sourcePages) 0) }}
<meta http-equiv="refresh" content="0; url={{ (index $sourcePages 0).RelPermalink }}">
<script>window.location.replace({{ (index $sourcePages 0).RelPermalink | jsonify }});</script>
<p>Redirecting to <a href="{{ (index $sourcePages 0).RelPermalink }}">{{ (index $sourcePages 0).Title }}</a>...</p>
{{ else }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using where .Pages "File.BaseFileName" "source" can cause a Hugo build failure (nil pointer evaluation) if any page in .Pages does not have a physical file (i.e., .File is nil), which is common for virtual or auto-generated section pages.

Additionally, storing the matched page in a variable avoids repeating index $sourcePages 0 multiple times. We can safely find the source page by iterating and checking if .File is present.

{{ $sourcePage := "" }}
{{ range .Pages }}
  {{ if and .File (eq .File.BaseFileName "source") }}
    {{ $sourcePage = . }}
  {{ end }}
{{ end }}
{{ if and (hasPrefix .RelPermalink "/integrations/") $sourcePage }}
<meta http-equiv="refresh" content="0; url={{ $sourcePage.RelPermalink }}">
<script>window.location.replace({{ $sourcePage.RelPermalink | jsonify }});</script>
<p>Redirecting to <a href="{{ $sourcePage.RelPermalink }}">{{ $sourcePage.Title }}</a>...</p>
{{ else }}

@Yuan325 Yuan325 added docs: deploy-preview Label to trigger Github Action docs preview. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed docs: deploy-preview Label to trigger Github Action docs preview. labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Preview Ready!

🔎 View Preview: https://pr-3775.toolbox-docs-6xc.pages.dev

(Note: Subsequent pushes to this PR will automatically update the preview at this same URL)

@Yuan325

Yuan325 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Hi @lyydsheep thank you for your contribution. I was testing the /integrations/alloydb/ path but seems like it's still showing a blank page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: deploy-preview Label to trigger Github Action docs preview. priority: p2 Moderately-important priority. Fix may not be included in next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dead links at /integrations/*

2 participants