Skip to content

Commit 89f9bc0

Browse files
authored
Merge pull request #1314 from maharshi-gor/seo_optimization_cherrypick
Seo optimization cherrypick
2 parents 10e493f + c0e0dd7 commit 89f9bc0

10 files changed

Lines changed: 76 additions & 2 deletions

File tree

docs/source/_extra/robots.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
User-agent: *
2+
Allow: /
3+
Disallow: /dev/
4+
Disallow: /v*/
5+
6+
Sitemap: https://fury.gl/latest/sitemap.xml

docs/source/_templates/home.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{% extends "layout.html" %}
22

33
{% block extrahead %}
4+
{# sphinxext-opengraph skips this page: it has no doctree, so the tags are set here. #}
5+
<meta name="description" content="FURY - Free Unified Rendering in pYthon. A free and open-source software library for Scientific Visualization and 3D animations.">
6+
<meta property="og:type" content="website">
7+
<meta property="og:title" content="FURY - Free Unified Rendering in pYthon">
8+
<meta property="og:description" content="A free and open-source Python library for Scientific Visualization and 3D animations, GPU accelerated through pygfx and WebGPU.">
9+
<meta property="og:url" content="{{ pageurl }}">
10+
<meta property="og:image" content="{{ pageurl }}_static/images/text-logo.png">
11+
<meta name="twitter:card" content="summary_large_image">
412
<link rel="preconnect" href="https://fonts.googleapis.com">
513
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
614
<link href="https://fonts.googleapis.com/css2?family=Barlow:wght@800;900&display=swap" rel="stylesheet">

docs/source/conf.py

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@
5656
"ext.github_tools",
5757
"ext.rstjinja",
5858
"ablog",
59+
"sphinx_sitemap",
60+
"sphinxext.opengraph",
61+
]
62+
63+
html_baseurl = os.environ.get("SPHINX_HTML_BASE_URL", "https://fury.gl/latest/")
64+
65+
# Open Graph configuration
66+
ogp_site_url = html_baseurl
67+
ogp_image = html_baseurl + "_static/images/text-logo.png"
68+
69+
# Sitemap configuration. html_baseurl already points at this build's own
70+
# deploy root (e.g. /dev/, /latest/, /vX.Y.x/), so the default scheme's
71+
# version/language prefixes are redundant and dropped. See _extra/robots.txt.
72+
sitemap_filename = "sitemap.xml"
73+
sitemap_url_scheme = "{link}"
74+
# Generated indexes and source views, of no value in search results.
75+
sitemap_excludes = [
76+
"search.html",
77+
"genindex.html",
78+
"py-modindex.html",
79+
"_modules/*",
80+
"*sg_execution_times.html",
5981
]
6082

6183
# Configuration options for plot_directive. See:
@@ -145,7 +167,7 @@
145167
"navigation_with_keys": True,
146168
"navbar_start": ["navbar-logo"],
147169
"navbar_center": ["custom-navbar-nav.html"],
148-
"navbar_end": ["navbar-icon-links", "theme-switcher"],
170+
"navbar_end": ["version-switcher", "navbar-icon-links", "theme-switcher"],
149171
"logo": {
150172
"text": "FURY",
151173
},
@@ -174,7 +196,7 @@
174196
html_css_files = ["css/fury_theme.css"]
175197
html_additional_pages = {"index": "home.html"}
176198

177-
# html_baseurl = os.environ.get("SPHINX_HTML_BASE_URL", "http://127.0.0.1:8000/")
199+
html_extra_path = ["_extra"]
178200

179201
html_logo = "_static/images/logo.svg"
180202

@@ -291,3 +313,22 @@
291313
"dipy": ("https://docs.dipy.org/stable", None),
292314
"scikit-learn": ("https://scikit-learn.org/stable/", None),
293315
}
316+
317+
318+
def _home_page_context(app, pagename, templatename, context, doctree):
319+
"""
320+
Fix up context for the home page.
321+
322+
It renders via home.html through html_additional_pages, which Sphinx builds
323+
with an empty context (no doctree) - so ``title`` is never populated (the
324+
<title> tag ends up empty) and ``pageurl`` resolves to /index.html instead
325+
of the site root.
326+
"""
327+
if pagename == "index":
328+
context["title"] = "FURY - Free Unified Rendering in pYthon"
329+
if context.get("pageurl"):
330+
context["pageurl"] = app.config.html_baseurl
331+
332+
333+
def setup(app):
334+
app.connect("html-page-context", _home_page_context)

docs/source/getting_started.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Getting Started
33
===============
44

5+
.. meta::
6+
:description: A quick-start guide to building your first scientific visualization scene with FURY in Python.
7+
58
Start by importing FURY.
69

710
.. code-block:: python

docs/source/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
Home Page
33

4+
.. This page renders from _templates/home.html, which is where its SEO meta tags live.
5+
46
.. toctree::
57
:maxdepth: 2
68
:caption: About FURY

docs/source/installation.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Installation
33
============
44

5+
.. meta::
6+
:description: Install FURY, the open-source Python library for scientific visualization and 3D animations, via pip or conda.
7+
58
FURY supports Python 3.5+. You can currently still use Python 2.7 but it will soon stop being supported as the Python 2.7 end of life is on December 31st 2019.
69

710
Dependencies

docs/source/introduction.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
About
33
=====
44

5+
.. meta::
6+
:description: Discover FURY, a powerful Python library for advanced scientific visualization and 3D animations. Open-source, GPU-accelerated, and easy to use.
7+
58
Overview
69
--------
710

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ doc = [
8484
"sphinx-copybutton",
8585
"sphinx-gallery>=0.10.0",
8686
"pydata-sphinx-theme==0.15.2",
87+
"sphinx-sitemap",
88+
"sphinxext-opengraph",
8789
"fury[window, plot, medical]",
8890
]
8991
style = ["ruff", "pre-commit"]
@@ -110,6 +112,8 @@ raw-options = { version_scheme = "release-branch-semver" }
110112
version-file = "fury/_version.py"
111113

112114
[tool.mypy]
115+
# NumPy >= 2.4 ships stubs that use PEP 695 `type` statements, which mypy only
116+
# accepts when targeting 3.12 or newer.
113117
python_version = "3.12"
114118
ignore_missing_imports = "True"
115119
exclude = [

requirements/all.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ tomli; python_version < "3.11"
2020
sphinx-copybutton
2121
sphinx-gallery>=0.10.0
2222
pydata-sphinx-theme==0.15.2
23+
sphinx-sitemap
24+
sphinxext-opengraph
2325
dipy
2426
nibabel
2527
matplotlib>=3.9.0

requirements/doc.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ tomli; python_version < "3.11"
88
sphinx-copybutton
99
sphinx-gallery>=0.10.0
1010
pydata-sphinx-theme==0.15.2
11+
sphinx-sitemap
12+
sphinxext-opengraph
1113
dipy
1214
nibabel
1315
matplotlib>=3.9.0

0 commit comments

Comments
 (0)