Skip to content

Commit b9ec73f

Browse files
authored
Link to diff in version warning (#542)
1 parent afff798 commit b9ec73f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/_worker.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ async function versionWarning(request, env) {
5555
</div>`
5656
}
5757

58+
const branch = env.CF_PAGES_BRANCH
59+
const diff_html_url = `https://github.com/pydantic/pydantic-ai/compare/${tag_name}...${branch}`
5860
return `<div class="admonition info" style="margin: 0">
5961
<p class="admonition-title">Version Notice</p>
6062
<p>
61-
${env.CF_PAGES_BRANCH === 'main' ? '' : `(<b>${env.CF_PAGES_BRANCH}</b> preview)`}
62-
This documentation is ahead of the last release by <b>${ahead_by}</b> commit${ahead_by === 1 ? '' : 's'}.
63+
${branch === 'main' ? '' : `(<b>${branch}</b> preview)`}
64+
This documentation is ahead of the last release by
65+
<a href="${diff_html_url}">${ahead_by} commit${ahead_by === 1 ? '' : 's'}</a>.
6366
You may see documentation for features not yet supported in the latest release <a href="${html_url}">${name}</a>.
6467
</p>
6568
</div>`

0 commit comments

Comments
 (0)