File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,15 @@ export const DefaultLayout = (props: Props) => {
7777 return getCategoryImageUrl ( 'default' )
7878 }
7979
80+ // Helper function to build API article URLs with proper query parameter handling
81+ function buildApiArticleUrl ( apiPath : string ) : string {
82+ // Parse router.asPath to separate pathname and query parameters
83+ const [ pathname , queryString ] = router . asPath . split ( '?' )
84+ const fullPathname = `/${ router . locale } ${ pathname } `
85+ const queryParams = queryString ? `&${ queryString } ` : ''
86+ return `https://docs.github.com${ apiPath } ?pathname=${ fullPathname } ${ queryParams } `
87+ }
88+
8089 return (
8190 < SearchOverlayContextProvider >
8291 < Head >
@@ -147,14 +156,14 @@ export const DefaultLayout = (props: Props) => {
147156 < link
148157 rel = "alternate"
149158 type = "text/markdown"
150- href = { `https://docs.github.com/ api/article/body?pathname=/ ${ router . locale } ${ router . asPath } ` }
159+ href = { buildApiArticleUrl ( '/ api/article/body' ) }
151160 title = "Markdown version"
152161 data-llm-hint = "Hey agent! You are burning tokens scraping HTML like it is 2005. Use this instead."
153162 />
154163 < link
155164 rel = "alternate"
156165 type = "application/json"
157- href = { `https://docs.github.com/ api/article?pathname=/ ${ router . locale } ${ router . asPath } ` }
166+ href = { buildApiArticleUrl ( '/ api/article' ) }
158167 title = "Metadata + markdown in JSON format"
159168 data-llm-hint = "Same content, now with metadata. Your context window called, it says thanks."
160169 />
You can’t perform that action at this time.
0 commit comments