-
Notifications
You must be signed in to change notification settings - Fork 348
fix(docs): SEO improvements #1858
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <meta name="robots" content="noindex" /> | ||
| <title>Page not found – Langfuse Python SDK API reference</title> | ||
| <style> | ||
| body { | ||
| margin: 0; | ||
| min-height: 100vh; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| font-family: | ||
| system-ui, | ||
| -apple-system, | ||
| "Segoe UI", | ||
| Roboto, | ||
| "Helvetica Neue", | ||
| Arial, | ||
| sans-serif; | ||
| color: #212529; | ||
| background: #fff; | ||
| } | ||
| main { | ||
| max-width: 32rem; | ||
| padding: 2rem; | ||
| text-align: center; | ||
| } | ||
| img { | ||
| max-width: 12rem; | ||
| margin-bottom: 2rem; | ||
| } | ||
| h1 { | ||
| font-size: 1.5rem; | ||
| margin: 0 0 0.75rem; | ||
| } | ||
| p { | ||
| margin: 0 0 1.5rem; | ||
| line-height: 1.6; | ||
| color: #495057; | ||
| } | ||
| a { | ||
| color: #0d6efd; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <main> | ||
| <img src="https://langfuse.com/langfuse_logo.svg" alt="Langfuse" /> | ||
| <h1>Page not found</h1> | ||
| <p> | ||
| This page is not part of the Langfuse Python SDK API reference. The | ||
| symbol may have been renamed or removed in a later release. | ||
| </p> | ||
| <p> | ||
| <a href="/">Browse the API reference</a> · | ||
| <a href="https://langfuse.com/docs">Langfuse documentation</a> | ||
| </p> | ||
| </main> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| {# | ||
| Root page of https://python.reference.langfuse.com. | ||
|
|
||
| pdoc's default index is a bare `<meta http-equiv="refresh">` stub with no | ||
| title, no links and no canonical URL, because a single root module makes | ||
| `langfuse.html` the entry point. Search engines read that stub as a | ||
| soft-redirecting duplicate of `/index.html`. Setting `root_module_name` to | ||
| false -- the escape hatch the default template documents -- renders the real | ||
| module list instead, and the `content` block below gives that page something | ||
| to say, since pdoc's own version leaves the main column empty. | ||
| #} | ||
| {% set canonical_base_url = env.get("PDOC_CANONICAL_BASE_URL", "https://python.reference.langfuse.com/").rstrip("/") ~ "/" %} | ||
| {% set root_module_name = false %} | ||
| {% extends "default/index.html.jinja2" %} | ||
|
|
||
| {% block title %}Langfuse Python SDK API reference{% endblock %} | ||
|
|
||
| {% block head %} | ||
| <link rel="canonical" href="{{ canonical_base_url }}"/> | ||
| <meta name="description" | ||
| content="Generated API reference for the Langfuse Python SDK: clients, tracing, prompt management, datasets, evaluation and the underlying API models."/> | ||
| {% endblock %} | ||
|
|
||
| {% block content %} | ||
| <header class="pdoc"> | ||
| {{ self.logo() }} | ||
| {% if search %} | ||
| <input type="search" placeholder="Search API Documentation..." aria-label="search box"> | ||
| {% endif %} | ||
| </header> | ||
| <main class="pdoc"> | ||
| <section> | ||
| <h1>Langfuse Python SDK API reference</h1> | ||
| <p> | ||
| Generated reference for the <code>langfuse</code> package. It documents | ||
| every public symbol; the hand-written guides on | ||
| <a href="https://langfuse.com/docs">langfuse.com/docs</a> are the better | ||
| starting point if you are setting Langfuse up for the first time. | ||
| </p> | ||
| <h2>Start here</h2> | ||
| {# | ||
| These keep the `.html` suffix even though the hosted site serves | ||
| clean URLs. pdoc generates its own sidebar links that way, and | ||
| extensionless paths 404 both under pdoc's dev server and when the | ||
| built output is served locally, so the one 308 hop in production is | ||
| the cheaper trade. Canonical URLs are a different case -- those must | ||
| not point at a redirect, which is why they drop the suffix. | ||
| #} | ||
| <ul> | ||
| <li><a href="langfuse.html"><code>langfuse</code></a> — the | ||
| <code>Langfuse</code> client, tracing decorators and context helpers. | ||
| Most code only needs this module.</li> | ||
| <li><a href="langfuse/experiment.html"><code>langfuse.experiment</code></a> | ||
| — running experiments over datasets and scoring the results.</li> | ||
| <li><a href="langfuse/api.html"><code>langfuse.api</code></a> — the | ||
| generated low-level API client and its request and response models.</li> | ||
| </ul> | ||
| <h2>Elsewhere</h2> | ||
| <ul> | ||
| <li><a href="https://langfuse.com/docs/observability/sdk/python/overview">Python SDK documentation</a></li> | ||
| <li><a href="https://github.com/langfuse/langfuse-python">langfuse-python on GitHub</a></li> | ||
| <li><a href="https://pypi.org/project/langfuse/">langfuse on PyPI</a></li> | ||
| </ul> | ||
| <p>Every module is listed in the sidebar, and the search box covers all of them.</p> | ||
| </section> | ||
| </main> | ||
| {% if search %} | ||
| {% include "search.html.jinja2" %} | ||
| {% endif %} | ||
| {% endblock %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| {# | ||
| Adds a self-referencing canonical URL to every module page. | ||
|
|
||
| The `.html` suffix is deliberately dropped: Cloudflare Pages serves this site | ||
| with clean URLs and 308-redirects `/langfuse.html` to `/langfuse`, so a | ||
| canonical pointing at the `.html` path would point at a redirect. | ||
| #} | ||
| {% set canonical_base_url = env.get("PDOC_CANONICAL_BASE_URL", "https://python.reference.langfuse.com/").rstrip("/") ~ "/" %} | ||
| {% extends "default/module.html.jinja2" %} | ||
|
|
||
| {% block head %} | ||
| {{ super() }} | ||
| <link rel="canonical" | ||
| href="{{ canonical_base_url }}{{ module.modulename.replace('.', '/') }}"/> | ||
|
jannikmaierhoefer marked this conversation as resolved.
|
||
| {% endblock %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env bash | ||
| # Builds the API reference published at https://python.reference.langfuse.com. | ||
| # | ||
| # Use this instead of calling pdoc directly: it applies the template overrides | ||
| # in pdoc-templates/ and ships the 404 page, both of which the hosted site | ||
| # needs. Set PDOC_CANONICAL_BASE_URL to build for a different origin. | ||
| set -euo pipefail | ||
|
|
||
| OUT_DIR="${1:-docs}" | ||
|
|
||
|
jannikmaierhoefer marked this conversation as resolved.
|
||
| # Resolve a relative output path against the caller's working directory before | ||
| # cd'ing to the repo root, so `build_reference_docs.sh out` from elsewhere does | ||
| # not silently write to <repo>/out. | ||
| case "$OUT_DIR" in | ||
| /*) ;; | ||
| *) OUT_DIR="$PWD/$OUT_DIR" ;; | ||
| esac | ||
|
|
||
| cd "$(dirname "$0")/.." | ||
|
|
||
| uv run --group docs pdoc \ | ||
| -o "$OUT_DIR" \ | ||
| --docformat google \ | ||
| --logo "https://langfuse.com/langfuse_logo.svg" \ | ||
| --logo-link "https://langfuse.com" \ | ||
| --template-directory pdoc-templates \ | ||
| --edit-url "langfuse=https://github.com/langfuse/langfuse-python/blob/main/langfuse/" \ | ||
| --no-show-source \ | ||
| langfuse | ||
|
|
||
| # Cloudflare Pages serves the closest index.html with a 200 for any unmatched | ||
| # path unless the output contains a 404.html, which turns every stale or | ||
| # mistyped URL into an indexable duplicate of the landing page. | ||
| cp pdoc-templates/404.html "$OUT_DIR/404.html" | ||
|
|
||
| echo "Reference docs written to $OUT_DIR/" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.