2015-10-09 32 views
2

我有以下index.rst文件。如何編輯Sphinx雪花石膏主題下的Sidebar

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` 

現在側邊欄看起來是這樣的:

enter image description here

由於該圖像中所描述。我想要做幾件事情。

  1. 去掉標題只在側邊欄但保持它的主頁。
  2. 添加新的URL鏈接,但沒有表現出像「指標和表」在主頁它

我怎麼能這樣做?

+0

[文檔](http://alabaster.readthedocs .io/en/latest/customization.html)描述瞭如何克服這些問題。 – Carel

回答

4

我終於固定它通過以下方式

在獅身人面像的_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', 
      ] 

     } 

在最後它看起來像這樣:

enter image description here

1

我可以爲第一個問題提出一些建議。我絕不是CSS方面的專家,所以我的解決方案可能不是更優雅的方案,但它的工作原理!把你的「源/ _static/custom.css」文件:

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

也許一個CSS專家應該給出一個更好的選擇......