<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Read the Docs Blog - Posts tagged sphinx</title>
  <id>https://blog.readthedocs.com/archive/tag/sphinx/atom.xml</id>
  <updated>2022-01-26T00:00:00Z</updated>
  <link href="https://blog.readthedocs.com" />
  <link href="https://blog.readthedocs.com/archive/tag/sphinx/atom.xml" rel="self" />
  <generator uri="http://ablog.readthedocs.org" version="0.9.5">ABlog</generator>
  <entry xml:base="https://blog.readthedocs.com/archive/tag/sphinx/atom.xml">
    <title type="text">Sphinx 4.4 release and other ecosystem news</title>
    <id>https://blog.readthedocs.com/sphinx-4-4-release-other-ecosystem-news/</id>
    <updated>2022-01-26T00:00:00Z</updated>
    <published>2022-01-26T00:00:00Z</published>
    <link href="https://blog.readthedocs.com/sphinx-4-4-release-other-ecosystem-news/" />
    <author>
      <name>Juan Luis Cano Rodríguez</name>
    </author>
    <content type="html">&lt;div class=&quot;section&quot; id=&quot;sphinx-4-4-release-and-other-ecosystem-news&quot;&gt;

&lt;p&gt;In this post we spread the word about
the most relevant news of the Sphinx ecosystem of the past weeks,
including Sphinx itself as well as extensions and themes developed by the community.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;sphinx-4-4-release&quot;&gt;
&lt;h2&gt;Sphinx 4.4 release&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Sphinx 4.4&lt;/strong&gt; was released on January 17th with numerous changes, including:&lt;/p&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;Better control of intersphinx references with the &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;:external:&lt;/span&gt;&lt;/code&gt; role&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;One of the power features of Sphinx is the ability to include
cross references across projects, using &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html&quot; title=&quot;(in Sphinx v5.0.0+)&quot;&gt;&lt;span class=&quot;xref std std-doc&quot;&gt;intersphinx&lt;/span&gt;&lt;/a&gt;.
By default, Sphinx transparently attempts to locate objects in external projects
if they are not found in the current one,
which is useful but also can become confusing in some cases.
The new &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#role-external&quot; title=&quot;(in Sphinx v5.0.0+)&quot;&gt;&lt;code class=&quot;xref rst rst-role docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;external&lt;/span&gt;&lt;/code&gt;&lt;/a&gt; role, coupled with the
&lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#confval-intersphinx_disabled_reftypes&quot;&gt;intersphinx_disabled_reftypes&lt;/a&gt;
configuration introduced in Sphinx 4.3,
enables documentation writers to control
when intersphinx references should be used.&lt;/p&gt;
&lt;p&gt;You can use the new &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;:external:&lt;/span&gt;&lt;/code&gt; role as follows:&lt;/p&gt;
&lt;div class=&quot;highlight-rst notranslate&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;External reference: &lt;span class=&quot;na&quot;&gt;:external:py:class:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`zipfile.ZipFile`&lt;/span&gt;.
External reference with constrained domain lookup: :external+python&lt;span class=&quot;na&quot;&gt;:py:class:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`zipfile.ZipFile`&lt;/span&gt;.
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;See more information in &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#role-external&quot; title=&quot;(in Sphinx v5.0.0+)&quot;&gt;&lt;code class=&quot;xref rst rst-role docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;official&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;documentation&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;New asynchronous methods to load JavaScript files&lt;/dt&gt;&lt;dd&gt;The method &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_js_file&quot; title=&quot;(in Sphinx v5.0.0+)&quot;&gt;&lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sphinx.application.Sphinx.add_js_file()&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;
now accepts a new &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;loading_method&lt;/span&gt;&lt;/code&gt; parameter that can either be &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;quot;async&amp;quot;&lt;/span&gt;&lt;/code&gt; or &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;quot;defer&amp;quot;&lt;/span&gt;&lt;/code&gt;,
which results in the script being loaded with the
&lt;a class=&quot;reference external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async&quot;&gt;async&lt;/a&gt; or
&lt;a class=&quot;reference external&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-defer&quot;&gt;defer&lt;/a&gt;
HTML attributes respectively.&lt;/dd&gt;
&lt;dt&gt;Proper error messages when autosummary does not find a package&lt;/dt&gt;&lt;dd&gt;Sphinx ships the &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html&quot; title=&quot;(in Sphinx v5.0.0+)&quot;&gt;&lt;span class=&quot;xref std std-doc&quot;&gt;autosummary&lt;/span&gt;&lt;/a&gt; extension
to automatically generate API pages of a Python library.
However, autosummary used to raise misleading error messages if the target library failed to import,
which resulted in user frustration.
This problem has now been fixed and autosummary properly points out the reason of the &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;ImportError&lt;/span&gt;&lt;/code&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;You can read the &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/en/master/changes.html#release-4-4-0-released-jan-17-2022&quot;&gt;complete Sphinx 4.4.0 release
notes&lt;/a&gt; online.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;using-sphinx-4-4-on-read-the-docs&quot;&gt;
&lt;h3&gt;Using Sphinx 4.4 on Read the Docs&lt;/h3&gt;
&lt;p&gt;Sphinx 4.4 is supported on Read the Docs. By default, RTD will install the latest version for you,
as described in &lt;a class=&quot;reference external&quot; href=&quot;https://docs.readthedocs.io/en/stable/builds.html#external-dependencies&quot; title=&quot;(in Read the Docs user documentation v7.4.1)&quot;&gt;&lt;span class=&quot;xref std std-ref&quot;&gt;our documentation&lt;/span&gt;&lt;/a&gt;.
If you are &lt;a class=&quot;reference external&quot; href=&quot;https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html#pinning-dependencies&quot; title=&quot;(in Read the Docs user documentation v7.4.1)&quot;&gt;&lt;span class=&quot;xref std std-ref&quot;&gt;pinning your dependencies&lt;/span&gt;&lt;/a&gt;
to improve the reproducibility of your builds,
you can change the pinned version to &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sphinx==4.4.0&lt;/span&gt;&lt;/code&gt;
in either your &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;requirements.txt&lt;/span&gt;&lt;/code&gt; or &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;environment.yml&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;sphinx-themes-and-extensions&quot;&gt;
&lt;h2&gt;Sphinx themes and extensions&lt;/h2&gt;
&lt;p&gt;Several other extensions and themes saw new releases recently, including:&lt;/p&gt;
&lt;dl class=&quot;docutils&quot;&gt;
&lt;dt&gt;&lt;a class=&quot;reference external&quot; href=&quot;https://github.com/pydata/pydata-sphinx-theme/releases/tag/v0.8.0&quot;&gt;pydata-sphinx-theme 0.8&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;pydata-sphinx-theme is a Sphinx theme based on Bootstrap CSS developed by the PyData community,
The Read the Docs team collaborated with the developers
to make some of the new features of 0.8 behave correctly in our platform, in particular
&lt;a class=&quot;reference external&quot; href=&quot;https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#add-a-dropdown-to-switch-between-docs-versions&quot;&gt;the custom version
switcher&lt;/a&gt;.
As &lt;a class=&quot;reference external&quot; href=&quot;https://twitter.com/choldgraf/status/1482435411301449729&quot;&gt;Chris Holdgraf summarizes in this Twitter
thread&lt;/a&gt;,
the new version brings other interesting additions,
like &lt;a class=&quot;reference external&quot; href=&quot;https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#navigation-depth-and-collapsing-of-the-sidebar&quot;&gt;better depth control of the left
sidebar&lt;/a&gt;
and &lt;a class=&quot;reference external&quot; href=&quot;https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#local-image-icons&quot;&gt;custom SVG
icons&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;a class=&quot;reference external&quot; href=&quot;https://sphinx-codeautolink.readthedocs.io/en/stable/release_notes.html#id2&quot;&gt;sphinx-codeautolink 0.9&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;sphinx-codeautolink is a Sphinx extension to automatically include links inside code blocks.
The 0.9 version now links Python builtin objects if intersphinx is properly configured
and has several logging improvements.&lt;/p&gt;
&lt;div class=&quot;figure align-center&quot; id=&quot;id1&quot;&gt;
&lt;img alt=&quot;Demo of sphinx-codeautolink&quot; src=&quot;../../../_images/sphinx-codeautolink.gif&quot; /&gt;
&lt;p class=&quot;caption&quot;&gt;&lt;span class=&quot;caption-text&quot;&gt;Demo of sphinx-codeautolink&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;a class=&quot;reference external&quot; href=&quot;https://documatt.gitlab.io/sphinxcontrib-constdata/&quot;&gt;sphinxcontrib-constdata 1.0&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;sphinxcontrib-constadata is a new Sphinx extension that allows documentation writers to
easily load data stored in CSV, JSON, and YAML files.
For example, it can be used to load UI labels (button labels, menu selection labels)
from external files instead of hardcoding them in the documentation for better maintenance,
for example:&lt;/p&gt;
&lt;div class=&quot;highlight-rst notranslate&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Choose menu item &lt;span class=&quot;na&quot;&gt;:constdata:label:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`menu.yaml?FileSaveAs`&lt;/span&gt;.
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;upcoming&quot;&gt;
&lt;h2&gt;Upcoming&lt;/h2&gt;
&lt;p&gt;The Executable Books Project team is working on several exciting things around MyST,
including &lt;a class=&quot;reference external&quot; href=&quot;https://github.com/executablebooks/MyST-Parser/pull/507&quot;&gt;the upcoming MyST-Parser 0.17 release&lt;/a&gt;
and &lt;a class=&quot;reference external&quot; href=&quot;https://twitter.com/choldgraf/status/1485666900784730112&quot;&gt;direct integration with Jupyter notebooks&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;figure align-center&quot; id=&quot;id2&quot;&gt;
&lt;img alt=&quot;Preview of MyST integrated in Jupyter notebooks.&quot; src=&quot;../../../_images/jupyter-myst.gif&quot; /&gt;
&lt;p class=&quot;caption&quot;&gt;&lt;span class=&quot;caption-text&quot;&gt;Preview of MyST integrated in Jupyter notebooks.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;We are excited about seeing new and old Sphinx extensions being developed by the community,
and we thank the Sphinx maintainers for their excellent work.&lt;/p&gt;
&lt;hr class=&quot;docutils&quot; /&gt;
&lt;p&gt;Considering using Read the Docs for your next Sphinx?
Check out &lt;a class=&quot;reference external&quot; href=&quot;https://docs.readthedocs.io/&quot;&gt;our documentation&lt;/a&gt; to get started!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry xml:base="https://blog.readthedocs.com/archive/tag/sphinx/atom.xml">
    <title type="text">Optimizing Sphinx Documentation for Search Engines</title>
    <id>https://blog.readthedocs.com/seo-for-technical-docs/</id>
    <updated>2019-08-29T00:00:00Z</updated>
    <published>2019-08-29T00:00:00Z</published>
    <link href="https://blog.readthedocs.com/seo-for-technical-docs/" />
    <author>
      <name>David Fischer</name>
    </author>
    <content type="html">&lt;div class=&quot;section&quot; id=&quot;optimizing-sphinx-documentation-for-search-engines&quot;&gt;

&lt;p&gt;Recently, we published a guide on &lt;a class=&quot;reference external&quot; href=&quot;https://docs.readthedocs.io/en/latest/guides/technical-docs-seo-guide.html&quot;&gt;SEO for technical docs&lt;/a&gt;
with the goal of helping documentation authors and project maintainers create docs
so that end users can find what they’re looking for easier.&lt;/p&gt;
&lt;p&gt;One developer asked me point blank after I mentioned our new guide,
“Hasn’t Google closed most of the loopholes that sites use to rank better?”.
I’ve heard this opinion from a few technologists before so I wasn’t too surprised.
Moz.com, an authority on search engine optimization,
makes a distinction between what they call &lt;a class=&quot;reference external&quot; href=&quot;https://moz.com/blog/black-hat-or-white-hat-seo-ask-better-questions&quot;&gt;black hat SEO and white hat SEO&lt;/a&gt;
to differentiate between these “loopholes” and more useful site improvements that help SEO.&lt;/p&gt;
&lt;p&gt;Black hat SEO is basically a set of tactics some sites use to improve rankings
without actually making their site better to end visitors.
This includes techniques like displaying different content to search engines (cloaking),
link farming, or adding semi-relevant keywords into a page (keyword stuffing).
When Google and Bing discover a site doing this,
they take action and lower a site’s ranking until the problems are fixed.
Black hat SEO is inherently risky and we try to stay away from this kind of SEO.&lt;/p&gt;
&lt;p&gt;Instead our guide focuses on white hat SEO which aims to improve your docs’ search engine rankings
by helping search engine’s understand and index your docs better and present it better to searchers.
This kind of SEO isn’t trying to cheat search engine rankings and it’s a win for everyone.
Searchers find the content they’re looking for more easily
while search engines understand the content better and can show more relevant results.&lt;/p&gt;
&lt;p&gt;Specifically, we also tried to focus on SEO for documentation
and how Sphinx and Read the Docs make it easier including:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;Making your docs display better on search engine results&lt;/li&gt;
&lt;li&gt;Helping search engines understand and index your docs better&lt;/li&gt;
&lt;li&gt;Improving your ranking based on user and search engine feedback&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;section&quot; id=&quot;making-your-docs-display-better-in-search-results&quot;&gt;
&lt;h2&gt;Making your docs display better in search results&lt;/h2&gt;
&lt;div class=&quot;figure align-center&quot; id=&quot;id1&quot; style=&quot;width: 100%&quot;&gt;
&lt;a class=&quot;reference external image-reference&quot; href=&quot;_static/google-search-engine-results.png&quot;&gt;&lt;img alt=&quot;../../../_images/google-search-engine-results.png&quot; src=&quot;../../../_images/google-search-engine-results.png&quot; /&gt;&lt;/a&gt;
&lt;p class=&quot;caption&quot;&gt;&lt;span class=&quot;caption-text&quot;&gt;Google search engine results with the page title, URL, and a description.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Displaying more relevant information in search results will cause more people to click through to your docs.
Again, your goal is not to use cheap tactics to rank better and trick users into clicking.
Rather, you are trying to legitimately improve your content such that users
better understand what to expect on a page before they click.&lt;/p&gt;
&lt;p&gt;Some of the most important aspects of improved search listings are:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;Use descriptive and accurate titles in the HTML &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/code&gt; tag.
With Sphinx, the &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/code&gt; comes from the top heading on the page.&lt;/li&gt;
&lt;li&gt;Ensure your URLs are descriptive. They are displayed in search results.
For Sphinx, the URL uses the source file’s filename.&lt;/li&gt;
&lt;li&gt;Make sure the words your readers would search for to find your site
are actually included on your pages.
Ideally, these key words should be in your &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/code&gt; or description.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These concepts are not only important in helping guide users to click on your documentation,
most of the same optimizations are useful to the search engine when indexing your site
and when ranking your site for searchers.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;helping-search-engines-understand-your-docs&quot;&gt;
&lt;h2&gt;Helping search engines understand your docs&lt;/h2&gt;
&lt;p&gt;Search engines like Google and Bing crawl through the internet
following links and redirects in an attempt to understand and build an index
of what various pages and sites are about.&lt;/p&gt;
&lt;p&gt;These tips and features can help you control how search engines index your docs:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;Make sure your entire site can be navigated by following links.
If you have “orphan” pages, a search engine won’t find them.
Using Sphinx’s “toctree” directive helps make sure all your pages are indexed and navigable.&lt;/li&gt;
&lt;li&gt;Redirects and canonical URLs are useful when the same content exists in multiple places
or moves from one page to another.
Read the Docs dashboard lets authors setup redirects from one page to another
or from one version of the documentation to another.&lt;/li&gt;
&lt;li&gt;Using a &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;robots.txt&lt;/span&gt;&lt;/code&gt; and &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;sitemap.xml&lt;/span&gt;&lt;/code&gt; file can help you control how search engines crawl your docs.
For example, you could tell search engines to ignore unsupported versions of your documentation.
Read the Docs provides both a &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;robots.txt&lt;/span&gt;&lt;/code&gt; and a sitemap and has ways for you to override them.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;improving-your-seo-ranking-from-feedback&quot;&gt;
&lt;h2&gt;Improving your SEO ranking from feedback&lt;/h2&gt;
&lt;p&gt;Search engines provide tools to help webmasters build their site better
and to give insights and feedback about the indexing of sites by the search engine spiders.
&lt;a class=&quot;reference external&quot; href=&quot;https://search.google.com/search-console&quot;&gt;Google Search Console&lt;/a&gt; and
&lt;a class=&quot;reference external&quot; href=&quot;https://www.bing.com/webmaster/help/webmaster-guidelines-30fba23a&quot;&gt;Bing Webmaster Tools&lt;/a&gt;
are tools for webmasters
to get feedback about the crawling of their sites (or docs in our case).
These tools can show technical issues with indexing like pages that are failing for some reason
and also possible security or spam issues on your site that can lower your ranking.&lt;/p&gt;
&lt;div class=&quot;figure align-center&quot; id=&quot;id2&quot; style=&quot;width: 100%&quot;&gt;
&lt;a class=&quot;reference external image-reference&quot; href=&quot;_static/google-search-console.png&quot;&gt;&lt;img alt=&quot;../../../_images/google-search-console.png&quot; src=&quot;../../../_images/google-search-console.png&quot; /&gt;&lt;/a&gt;
&lt;p class=&quot;caption&quot;&gt;&lt;span class=&quot;caption-text&quot;&gt;Google search console showing an issue with user generated spam, a constant battle at Read the Docs.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Feedback on keywords users use to find your docs is also really helpful.
This is true both for the phrases people searched for on a search engine
and for the search terms people queried in Sphinx and Read the Docs’ built-in search features.
Analytics tools like Google Analytics can provide these insights,
but as part of our &lt;a class=&quot;reference internal&quot; href=&quot;../../../improved-search-and-search-as-you-type/&quot;&gt;&lt;span class=&quot;doc&quot;&gt;search improvements and search analytics&lt;/span&gt;&lt;/a&gt;,
Read the Docs is going to show project maintainers the most common search queries to help them improve as well.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;seo-is-no-substitute-for-good-writing&quot;&gt;
&lt;h2&gt;SEO is no substitute for good writing&lt;/h2&gt;
&lt;p&gt;One area we didn’t detail in our guide is how more general improvements to technical writing
can also improve your search engine rankings. This could be a whole post by itself.&lt;/p&gt;
&lt;p&gt;Using simpler words, for example, has a number of advantages in technical writing.
The excellent Microsoft Style Guide &lt;a class=&quot;reference external&quot; href=&quot;https://docs.microsoft.com/en-us/style-guide/word-choice/use-simple-words-concise-sentences&quot;&gt;recommends using simple words and concise sentences&lt;/a&gt;
and Apple’s Style Guide &lt;a class=&quot;reference external&quot; href=&quot;https://help.apple.com/applestyleguide/#/apsg1ff68ab5&quot;&gt;echoes the same sentiment&lt;/a&gt;.
Simpler sentences are easier to understand for both people
as well as machines like search engines and automatic translators.&lt;/p&gt;
&lt;p&gt;While any style guide you read will tell you to avoid using jargon,
technical writing and software docs have a certain amount of unavoidable technical terminology.
Defining these terms and phrases when you first use them helps users as well as search engines.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;in-summary&quot;&gt;
&lt;h2&gt;In summary&lt;/h2&gt;
&lt;p&gt;Always keep in mind that your ultimate goal is to make your docs more discoverable by people, not machines.
While the concepts and tactics here will help you rank better with search engines,
providing high quality documentation and making it easier to find and understand
is the best way to make sure people actually read the docs.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry xml:base="https://blog.readthedocs.com/archive/tag/sphinx/atom.xml">
    <title type="text">Adding Custom CSS or JavaScript to Sphinx Documentation</title>
    <id>https://blog.readthedocs.com/custom-css-and-js-in-sphinx/</id>
    <updated>2019-07-10T00:00:00Z</updated>
    <published>2019-07-10T00:00:00Z</published>
    <link href="https://blog.readthedocs.com/custom-css-and-js-in-sphinx/" />
    <author>
      <name>David Fischer</name>
    </author>
    <content type="html">&lt;div class=&quot;section&quot; id=&quot;adding-custom-css-or-javascript-to-sphinx-documentation&quot;&gt;

&lt;p&gt;In the Read the Docs documentation, we have a number of
&lt;a class=&quot;reference external&quot; href=&quot;https://docs.readthedocs.io/page/guides/index.html&quot;&gt;how-to guides&lt;/a&gt;
to help people solve specific problems with Sphinx and Read the Docs.
By far our most popular guide is on
&lt;a class=&quot;reference external&quot; href=&quot;https://docs.readthedocs.io/page/guides/adding-custom-css.html&quot;&gt;adding custom CSS and JavaScript to Sphinx&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In some older versions of Sphinx, this process was a little more challenging
and it wasn’t as easy to figure out how to do it from the Sphinx docs.
Sphinx 1.8 really streamlined this process especially for the simple cases.&lt;/p&gt;
&lt;div class=&quot;section&quot; id=&quot;adding-additional-stylesheets-or-scripts&quot;&gt;
&lt;h2&gt;Adding additional stylesheets or scripts&lt;/h2&gt;
&lt;p&gt;If your custom stylesheet is &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_static/css/custom.css&lt;/span&gt;&lt;/code&gt;,
you can add that CSS file to the documentation using the
Sphinx option &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/page/usage/configuration.html#confval-html_css_files&quot;&gt;html_css_files&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight-python notranslate&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;## conf.py&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# These folders are copied to the documentation&amp;#39;s HTML output&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;html_static_path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;_static&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# These paths are either relative to html_static_path&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# or fully qualified paths (eg. https://...)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;html_css_files&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&amp;#39;css/custom.css&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;A similar approach can be used to add JavaScript files:&lt;/p&gt;
&lt;div class=&quot;highlight-python notranslate&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html_js_files&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&amp;#39;js/custom.js&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;That’s it!
You don’t need to create a Sphinx extension anymore to add a bit of custom CSS or JavaScript.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;customizations-supported-by-your-theme&quot;&gt;
&lt;h2&gt;Customizations supported by your theme&lt;/h2&gt;
&lt;p&gt;I should also note that depending on the theme you’re using and what you’re hoping to accomplish,
you may not even need to add custom CSS or JavaScript.
Many themes support a number of “theme options”
for customizing their look and feel without having to write custom code.
For example, here are all the options for the &lt;a class=&quot;reference external&quot; href=&quot;https://sphinx-rtd-theme.readthedocs.io/page/configuring.html&quot;&gt;Read the Docs theme&lt;/a&gt; and the &lt;a class=&quot;reference external&quot; href=&quot;https://alabaster.readthedocs.io/page/customization.html&quot;&gt;Alabaster theme&lt;/a&gt;
which are the two most popular themes on Read the Docs itself.&lt;/p&gt;
&lt;p&gt;Both themes, for example, support the addition of Google Analytics to documentation by setting the &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;analytics_id&lt;/span&gt;&lt;/code&gt; option:&lt;/p&gt;
&lt;div class=&quot;highlight-python notranslate&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;## conf.py&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;html_theme_options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&amp;#39;analytics_id&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;UA-XXXXXXX-1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;#  Provided in your GA dashboard&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;in-summary&quot;&gt;
&lt;h2&gt;In summary&lt;/h2&gt;
&lt;p&gt;To recap, it only takes a few additions to your &lt;code class=&quot;docutils literal notranslate&quot;&gt;&lt;span class=&quot;pre&quot;&gt;conf.py&lt;/span&gt;&lt;/code&gt; to add custom CSS or JavaScript.
However, it’s also worth taking a look at your theme’s docs or &lt;a class=&quot;reference external&quot; href=&quot;https://www.sphinx-doc.org/page/usage/configuration.html#options-for-html-output&quot;&gt;Sphinx’s built-in HTML options&lt;/a&gt;
to see if what you’re trying to do is already supported.&lt;/p&gt;
&lt;p&gt;Happy documenting!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
</feed>
