Skip to content

docs: improve PyFluent docs discoverability - #5355

Draft
seanpearsonuk wants to merge 4 commits into
mainfrom
doc/discover
Draft

docs: improve PyFluent docs discoverability#5355
seanpearsonuk wants to merge 4 commits into
mainfrom
doc/discover

Conversation

@seanpearsonuk

@seanpearsonuk seanpearsonuk commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

docs: improve PyFluent docs discoverability (SEO)

AI generated PR / WIP

Background

Searching for "PyFluent" and related terms (e.g. "PyFluent cheat sheet",
"PyFluent settings API") currently surfaces the Ansys Developer forum
(developer.ansys.com / developer.synopsys.com) ahead of the official
PyAnsys documentation, and in some cases the official docs don't appear at
all in the first several pages of results. Forum content is unmaintained
and can be materially out of date compared to the maintained docs.

Investigation confirmed this is not a robots.txt block or a
de-indexing problem — fluent.docs.pyansys.com and its cheat sheet PDF
are indexed and do appear in search. The root causes are ranking-signal
problems that are fixable independent of Ansys's overall domain authority:

  1. Duplicate/fragmented content — the same cheat sheet PDF exists at
    three separate URLs (fluent.docs.pyansys.com/version/stable/_static/cheat_sheet.pdf,
    fluent.docs.pyansys.com/version/dev/_static/cheat_sheet.pdf, and
    cheatsheets.docs.pyansys.com/pyfluent_cheat_sheet.pdf), splitting
    ranking signal three ways instead of consolidating it onto one URL.
  2. PDF vs. HTML — the cheat sheet is only published as a PDF. The
    competing forum page is a normal HTML blog post with real headings and
    anchor links, which Google generally indexes and ranks better for
    phrase-based queries than PDF text.
  3. No canonicalization across versions — every released version of
    PyFluent (/version/0.14/, /version/0.34.dev0/, /version/dev/,
    /version/stable/, etc.) is a near-duplicate page with no canonical
    tag pointing back to one authoritative URL, further diluting ranking
    signal for any single page.
  4. Weak internal/external linking — no confirmed backlink from the
    Ansys Developer forum back to the canonical PyAnsys docs, despite the
    forum content covering the same library.
  5. Unverified indexing hygienesitemap.xml presence/submission and
    Google Search Console coverage status had not been confirmed for
    fluent.docs.pyansys.com.

This PR applies the fixes for the ranking-signal problems that can be
addressed inside this repository. The remaining items (hosting-side
redirects, Google Search Console work, forum backlink request) still need
to be actioned outside the repo; they are called out below.

Root causes addressed

Root cause Fixed in this PR? Where
1. Duplicate/fragmented cheat sheet PDF URLs Partial (in-repo half only) See "Not in this PR" below
2. Cheat sheet only published as PDF, not HTML Yes New doc/source/cheatsheet/index.rst
3. No canonicalization across versions Yes conf.py + _templates/layout.html
4. Weak internal/external linking Partial Homepage now links the cheat sheet with the literal anchor text "PyFluent cheat sheet"
5. Unverified indexing hygiene (no sitemap) Yes (generation half) sphinx-sitemap added

Changes

1. Canonicalize every versioned docs page to stable

  • doc/source/conf.py — set
    html_baseurl = "https://fluent.docs.pyansys.com/version/stable/" and
    sitemap_url_scheme = "{link}".
  • doc/source/_templates/layout.html (new) — extends the
    ansys-sphinx-theme base template and injects
    <link rel="canonical" href=".../version/stable/{{ pagename }}.html"> in
    extrahead on every page.

This tells Google that /version/0.14/…, /version/dev/…,
/version/0.34.dev0/… etc. all consolidate onto the stable equivalent —
directly addressing root cause #3 (ranking signal split across every
released version).

2. Generate a real sitemap.xml

  • pyproject.toml — added sphinx-sitemap==2.6.0 to the doc
    dependency set.
  • doc/source/conf.py — registered sphinx_sitemap in extensions.

sitemap.xml will now be produced automatically on every doc build,
enabling submission via Google Search Console.

3. Publish the cheat sheet as a real HTML page

  • doc/source/cheatsheet/index.rst (new) — HTML cheat sheet with:
    • Reference target _ref_pyfluent_cheat_sheet for internal linking.
    • Intro paragraph front-loaded with the phrases the forum post ranks for:
      launching Ansys Fluent from Python, importing a mesh,
      defining materials, defining boundary conditions,
      modifying cell zone conditions, applying solution settings,
      accessing field data.
    • A .. contents:: block giving Google real anchor targets for each
      section — the "quick reference" jump-link UX pattern that is one
      reason the forum post currently wins.
    • Real <h2>/<h3> headings mirroring the Quarto cheat sheet content:
      Quick start, Launching Fluent, Reading and writing case and data files,
      Importing a mesh, Defining boundary conditions, Defining materials,
      Modifying cell zone conditions, Enabling physics models, Applying
      solution settings, Accessing field data, Reduction functions,
      Solution variables.
    • All code blocks copied from doc/source/cheatsheet/cheat_sheet.qmd
      so the two are content-equivalent at merge time.
  • doc/source/index.rst:
    • Added cheatsheet/index to the hidden toctree.
    • Added a prominent link in the "Getting started" section using the
      literal anchor text "PyFluent cheat sheet".

Not in this PR (out-of-repo follow-ups)

These items cannot be done in this repository and remain open:

  • Redirect duplicate cheat sheet PDFs. The two duplicates at
    fluent.docs.pyansys.com/version/{stable,dev}/_static/cheat_sheet.pdf
    still need to be 301'd (or stubbed with meta-refresh + canonical) to
    cheatsheets.docs.pyansys.com/pyfluent_cheat_sheet.pdf. Requires
    hosting/CI access. Recommended canonical location is
    cheatsheets.docs.pyansys.com since it acts as the shared hub across
    PyAnsys libraries.
  • Google Search Console. Verify fluent.docs.pyansys.com, submit the
    newly generated sitemap.xml, and request re-indexing of the canonical
    cheat sheet URL and a sample of stable pages. Check the Coverage /
    Page indexing report for the cheat sheet PDF URLs, looking for
    "Duplicate, Google chose different canonical" warnings clearing.
  • robots.txt. Add a Sitemap: line pointing at the generated
    sitemap.xml. Lives at the hosting root, not in Sphinx source.
  • Backlink from the Ansys Developer forum. Ask the forum content team
    to have the existing PyFluent cheat sheet and settings-API posts link
    to the canonical PyAnsys docs as the maintained source of truth.
  • Audit whether the settings API documentation has the same
    fragmentation issue as the cheat sheet.
  • Update external references (README.md, PyPI project description,
    other docs pages) to point at the new canonical cheat sheet URL
    directly, rather than relying on redirects.

Caveats and risks

  1. Blanket canonicalization to stable. html_baseurl and the
    injected canonical <link> are set unconditionally to the stable
    URL. On dev-only pages that don't yet exist in stable, this will
    canonicalize to a non-existent URL until the next release. If Search
    Console flags this, drive html_baseurl and the canonical URL from a
    CI env var so only stable/tagged builds inject a cross-version
    canonical and dev self-canonicalizes.
  2. Cheat sheet content is duplicated, not single-sourced. The ideal
    is one source generating both the PDF and the HTML. This PR copies the
    content from cheat_sheet.qmd into a new .rst rather than
    generating both from one source. Content drift risk is real; a
    follow-up issue to unify the source is recommended.
  3. Build not run locally. Reviewers should confirm the doc build
    passes in CI before merge.

Verification

Post-deploy verification enabled by this PR:

  • View source on any versioned docs page should show a canonical <link>
    pointing at the equivalent stable URL.
  • sitemap.xml should be present at the site root after deploy.
  • site:fluent.docs.pyansys.com "PyFluent cheat sheet" should, after
    re-crawl (typically 1–4 weeks), start surfacing the new HTML page
    rather than only the PDF. Ranking changes from canonicalization and
    redirects take days to a few weeks to appear; do not judge success
    from same-day search checks.
  • Search Console Coverage report should no longer flag
    duplicate/canonical conflicts for the cheat sheet URLs once the
    hosting-side redirects (see "Not in this PR") are also live.

Files changed

  • doc/source/conf.py — canonical base URL + sitemap extension.
  • doc/source/_templates/layout.htmlnew, canonical link injection.
  • doc/source/cheatsheet/index.rstnew, HTML cheat sheet.
  • doc/source/index.rst — toctree entry + homepage link.
  • pyproject.tomlsphinx-sitemap dependency.

@github-actions github-actions Bot added documentation Documentation related (improving, adding, etc) maintenance General maintenance of the repo (libraries, cicd, etc) dependencies Related to dependencies labels Aug 28, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI 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.

Pull request overview

Improves PyFluent documentation discoverability through canonical URLs, sitemap generation, and an HTML cheat sheet.

Changes:

  • Adds sitemap and canonical URL configuration.
  • Publishes and links an HTML cheat sheet.
  • Adds the required documentation dependency and changelog entry.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pyproject.toml Adds sphinx-sitemap.
doc/source/conf.py Configures sitemap and canonical URLs.
doc/source/_templates/layout.html Adds canonical metadata.
doc/source/cheatsheet/index.rst Introduces the HTML cheat sheet.
doc/source/index.rst Links the cheat sheet.
doc/changelog.d/5355.documentation.md Records the documentation change.
Suppressed comments (7)

doc/source/cheatsheet/index.rst:104

  • This rebinds turbulence to the string constant instead of updating turbulence_specification; the next access to turbulence.turbulent_intensity then fails because turbulence is no longer the settings object. Assign the constant to the setting property.
   turbulence = (
      turbulence.turbulence_specification.INTENSITY_AND_HYDRAULIC_DIAMETER
   )

doc/source/cheatsheet/index.rst:149

  • Assigning the enum value to the local k_epsilon_model variable does not change the Fluent setting, so the model remains at its previous/default variant. Assign it back through viscous.k_epsilon_model.
   k_epsilon_model = viscous.k_epsilon_model
   k_epsilon_model = k_epsilon_model.REALIZABLE

doc/source/cheatsheet/index.rst:156

  • This only replaces the local species variable with a string constant; it never enables species transport in Fluent. Keep the settings object and assign its model.option property.
   species = Species(solver).model.option
   species = species.SPECIES_TRANSPORT

doc/source/cheatsheet/index.rst:172

  • Reassigning grad_scheme changes only the local variable and leaves the solver's gradient scheme unchanged. The value must be assigned to the settings property.
   grad_scheme = methods.spatial_discretization.gradient_scheme
   grad_scheme = grad_scheme.GREEN_GAUSS_NODE_BASED

doc/source/cheatsheet/index.rst:182

  • The second assignment only rebinds a local variable, so the newly created report definition never receives a report type. Assign the value to the definition's report_type property.
   soln_report_type = rep_defs.surface["outlet-temp-avg"].report_type
   soln_report_type = soln_report_type.SURFACE_AREA

doc/source/cheatsheet/index.rst:192

  • This rebinds init_type without updating initialization.initialization_type, so the documented workflow does not select hybrid initialization. Assign the enum value to the setting property.
   init_type = initialization.initialization_type
   init_type = init_type.HYBRID

doc/source/cheatsheet/index.rst:83

  • Changing setup_type does not itself rebuild the Describe Geometry task's children. The workflow API requires update_child_tasks before reading/setting this argument and again after the value changes (as used in doc/source/user_guide/meshing/new_meshing_workflows.rst:62-66); otherwise the downstream watertight tasks can retain the wrong structure before volume meshing.
   watertight.describe_geometry.setup_type = "fluid"
   watertight.describe_geometry()

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


.. code-block:: python

session = pyfluent.Solver.from_connection(ip, port, password)
Comment thread doc/source/conf.py
# Canonical base URL used by sphinx-sitemap and by search engines to
# consolidate ranking signal onto the `stable` version of the docs.
# See pyfluent-doc-plan.md §4 and §5.
html_baseurl = "https://fluent.docs.pyansys.com/version/stable/"
Comment on lines +11 to +15
{% block extrahead %}
{{ super() }}
{%- if pagename %}
<link rel="canonical"
href="https://fluent.docs.pyansys.com/version/stable/{{ pagename }}.html" />
@seanpearsonuk

Copy link
Copy Markdown
Collaborator Author

@MaxJPRey @RobPasMue
@jgd10

I checked 7-8 PyAnsys repos and the pattern holds consistently: in every case I checked, the official docs are severely outranked in search results. As you know, PyAnsys docs are properly maintained, peer-reviewed and up to date. I hope that the kind of changes in this branch and additional comments in the description will contribute to an improvement (as noted in the description, the changes are AI-generated) that could be shared across repos.

It's possible a few repos have already addressed this independently and if any team has tackled it separately, it'd be worth comparing notes so we're not duplicating effort.

Separately: the Ansys forum consistently ranks above the official docs in these searches, despite that content being older, apaprently unmaintained, and not held to the same review process as our docs. Readers landing on it have no way of knowing that. I'd flag this as worth addressing.

@RobPasMue

Copy link
Copy Markdown
Member

Hi @seanpearsonuk thanks for bringing this to our attention! We have seen a decay in the ranking of our docs indeed, but @jorgepiloto has been investigating this issue and it is mostly related to a Google Console account subscription being required to rank higher in the SEO algorithms.

In fact, some of the operations being performed in this PR such as the sitemap.xml generation, is also done by the doc publishing actions.

Nonetheless, the canonicalization logic seems pretty interesting and reusable! Maybe we could move this to the Sphinx theme directly @jorgepiloto?

Regarding the cheat sheet being available as HTML - that is also an option for projects to have. However we are not enforcing teams to provide it in HTML for now. Worth looking into though - maybe we could find a way to have a single source of truth for the cheat sheet (either the .tex file or the .rst) and autogenerate the other one.

@jorgepiloto

Copy link
Copy Markdown
Member

Hi @seanpearsonuk, thanks for opening this.

We just noticed the same.

Our deploy actions should take care of sitemap generation and canonical links injection. This is because these actions have access to the full website, whereas Sphinx extensions do not conceive multi-version documentation.

My suspicions go in the path of Google classifying our pages as AI-generated due to the amount of duplicated content across versions.

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

Labels

dependencies Related to dependencies documentation Documentation related (improving, adding, etc) maintenance General maintenance of the repo (libraries, cicd, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants