-
Notifications
You must be signed in to change notification settings - Fork 875
Fix canonical URLs to use direct page paths #4165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
|
can you share the exact testing steps/validations/screenshots that you tested? |
| } | ||
| } | ||
| else { | ||
| //This content page is not in the expected frameset which contains the TOC so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this file generated? i see its in output-files folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the documentation generator to fix canonical URL formatting for better search engine indexing. The change moves from query parameter-based URLs (index.html?page=X&tocid=Y) to direct path URLs (items/S3/TS3Client.html), while preserving frameset redirect functionality through a new meta tag.
Key Changes
- Canonical URLs now point directly to documentation pages instead of frameset with query parameters
- Added
<meta name="aws-tocid">tag to store the table of contents ID needed for redirect logic - Updated JavaScript redirect logic to read tocid from meta tag instead of parsing canonical URL
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docgenerator/SDKDocGeneratorLib/Writers/BaseWriter.cs | Updated canonical URL format to use direct paths and added aws-tocid meta tag |
| docgenerator/SDKDocGeneratorLib/output-files/resources/parentloader.js | Modified frameset redirect logic to read tocid from meta tag and construct URL from current pathname |
| var filename = pathname.substring(pathname.lastIndexOf('/') + 1); | ||
| //Reload the parent frameset and this content page. The inFrame part of this script | ||
| //will run on reload to replace the address bar URL with the actual friendly content | ||
| //frame page URL. | ||
| window.location.href = basePath + '/index.html?page=' + filename + '&tocid=' + tocid; |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page parameter should include the full relative path from /items/ (e.g., S3/TS3Client.html), not just the filename. This is inconsistent with how displayLink is called in BaseWriter.cs line 245-246, which passes GenerateFilepath() + '/' + GenerateFilename().
Current code extracts only the filename:
var filename = pathname.substring(pathname.lastIndexOf('/') + 1);Should extract the full path after /items/:
var pagePath = pathname.substring(itemsIndex + '/items/'.length);Then use:
window.location.href = basePath + '/index.html?page=' + pagePath + '&tocid=' + tocid;| var filename = pathname.substring(pathname.lastIndexOf('/') + 1); | |
| //Reload the parent frameset and this content page. The inFrame part of this script | |
| //will run on reload to replace the address bar URL with the actual friendly content | |
| //frame page URL. | |
| window.location.href = basePath + '/index.html?page=' + filename + '&tocid=' + tocid; | |
| var pagePath = pathname.substring(itemsIndex + '/items/'.length); | |
| //Reload the parent frameset and this content page. The inFrame part of this script | |
| //will run on reload to replace the address bar URL with the actual friendly content | |
| //frame page URL. | |
| window.location.href = basePath + '/index.html?page=' + pagePath + '&tocid=' + tocid; |
Description
index.html?page=X&tocid=Yto direct paths likeitems/S3/TS3Client.html<meta name="aws-tocid">for redirect logicMotivation and Context
Canonical URLs pointed to frameset with query params. Search engines saw mismatch between canonical and actual page URL, hurting indexing.
Testing
Types of changes
Checklist
License