8

次のindex.rstファイルがあります。

Know the cell population of your data
=====================================
Some content

.. toctree::
   :maxdepth: 2

Installation
~~~~~~~~~~~~
.. toctree::
   :maxdepth: 2

   installation

Scripts
~~~~~~~
.. toctree::
   :maxdepth: 2

   scripts

API documentation
~~~~~~~~~~~~~~~~~
.. toctree::
   :maxdepth: 2

   apidoc

Roadmap
~~~~~~~
.. toctree::
   :maxdepth: 2

   roadmap

Indices and Tables
==================
* :ref: `genindex`

サイドバーは次のようになります。

ここに画像の説明を入力

その画像で説明されているように。いくつかやりたいことがあります。

  1. サイドバーのタイトルのみを削除し、メイン ページは維持します。
  2. 新しい URL リンクを追加しますが、「インデックスとテーブル」などのメイン ページには表示されません。

どうやってやるの?

4

2 に答える 2

10

私は最終的に次の方法でそれを修正しました

Sphinx の_templateディレクトリに というファイルを作成しますfoo.html

コンテンツは次のようになります。

<hr />
<p>
<h2 class='logo'>
<a href="https://foo.bar.com/">Web Version</a>
</h2>
</p>

最後にconf.pyにこれを追加します:

html_sidebars = {
        '**': [
                 'localtoc.html',
                 'relations.html',
                 'searchbox.html',
                 # located at _templates/
                 'foo.html',
            ]

        }

最終的には次のようになります。

ここに画像の説明を入力

于 2015-10-26T07:08:11.837 に答える
3

最初の質問に何か提案できます。私は決して CSS の専門家ではないので、私の解決策はおそらくより洗練されたものではありませんが、うまくいきます! 「source/_static/custom.css」ファイルに入れます:

.sphinxsidebar a.reference.internal[href='#'] {
  display: none;
}

おそらく、CSS の専門家がより優れたセレクターを提供する必要があります…</p>

于 2015-10-10T18:24:42.800 に答える