diff --git a/docs/requirements.txt b/docs/requirements.txt index 2b9895351..b82007f8a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,8 @@ -sphinx==5.0.0 -# torch -# PyTorch Theme --e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme +sphinx>=7.2.0 +-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2 +sphinx-design==0.6.1 +sphinx-sitemap==2.7.1 +sphinxext-opengraph +docutils>=0.18.1,<0.21 # For Graph Visualization graphviz diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css deleted file mode 100644 index 25dd69c70..000000000 --- a/docs/source/_static/css/custom.css +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -h1 { - font-size: 2rem; - letter-spacing: 1.78px; - line-height: 2.5rem; - margin: 1.375rem 0; - text-transform: none; /* Overwrite upper-case conversion of titles */ -} diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html deleted file mode 100644 index 7b7a77316..000000000 --- a/docs/source/_templates/layout.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "!layout.html" %} - -{% block sidebartitle %} -
- {{ version }} ▼ -
- {% include "searchbox.html" %} -{% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py index f25a089dd..865caf0c9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,7 +19,7 @@ import os import sys -import pytorch_sphinx_theme +import pytorch_sphinx_theme2 import torchdata # sys.path.insert(0, os.path.abspath('.')) @@ -55,6 +55,10 @@ "sphinx.ext.intersphinx", "sphinx.ext.doctest", "sphinx.ext.graphviz", + "sphinx_design", + "sphinx_sitemap", + "pytorch_sphinx_theme2", + "sphinxext.opengraph", ] # Do not execute standard reST doctest blocks so that documentation can @@ -62,7 +66,10 @@ doctest_test_doctest_blocks = "" # Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] +templates_path = [ + "_templates", + os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"), +] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -75,17 +82,50 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -# html_theme = 'alabaster' -html_theme = "pytorch_sphinx_theme" -html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()] +html_theme = "pytorch_sphinx_theme2" +html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()] + +# OpenGraph settings +ogp_site_url = "https://pytorch.org/data/" +ogp_image = "https://pytorch.org/assets/images/social-share.jpg" + +# Theme options +theme_variables = pytorch_sphinx_theme2.get_theme_variables() html_theme_options = { - "collapse_navigation": False, + "navigation_with_keys": False, + "analytics_id": "GTM-T8XT4PS", + "logo": { + "text": "TorchData", + }, + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/pytorch/data", + "icon": "fa-brands fa-github", + }, + { + "name": "PyPi", + "url": "https://pypi.org/project/torchdata/", + "icon": "fa-brands fa-python", + }, + ], + "use_edit_page_button": True, + "navbar_center": "navbar-nav", + "navbar_start": ["pytorch_version"], "display_version": True, - "logo_only": True, - "pytorch_project": "docs", - "navigation_with_keys": True, - "analytics_id": "UA-117752657-2", +} + +html_context = { + "theme_variables": theme_variables, + "display_github": True, + "github_url": "https://github.com", + "github_user": "pytorch", + "github_repo": "data", + "github_version": "main", + "doc_path": "docs/source", + "library_links": theme_variables.get("library_links", []), + "community_links": theme_variables.get("community_links", []), } # Add any paths that contain custom static files (such as style sheets) here, @@ -93,9 +133,14 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] -html_css_files = [ - "css/custom.css", +# Sitemap settings +html_baseurl = f"https://pytorch.org/data/{version}/" +sitemap_locales = [None] +sitemap_excludes = [ + "search.html", + "genindex.html", ] +sitemap_url_scheme = "{link}" signature_replacements = {}