sphinx as project site generator, custom frontpage

69 views
Skip to first unread message

Richard Duivenvoorde

unread,
May 23, 2013, 2:50:07 AM5/23/13
to sphin...@googlegroups.com

Hi,

currently we are using a gettext/sphinx tool chain to generate both our project website AND the documentations: http://docs.qgis.org
see https://github.com/qgis/QGIS-Documentation

translators translate the po files generated from the rst sources, the layout is 'responsive' by the use of twitter bootstrap in the layout.html

BUT on the frontpage we want to have another layout (in bootstrap terms: eg a caroussel, or some other 'marketing' stuff)

I've tried to do that using html_additional_pages and a special 'frontpage.html' template file.

I see the caroussel etc (from the template), but in that way the source text from index.rst does not show up in the frontpage (index.html)

Looking in the source code, it seems to me that the pages from 'html_additional_pages' are not created using a 'context'?

Does that mean that I am not supposed to use source files for that pages?

Or in other words: how do I define the sources for custom layout pages in rst (not in the templates)

Hope someone can help us. The way we do the internationalisation now forces or more or less to do as most as possible via rst sources

Regards,

Richard Duivenvoorde

Takayuki Shimizukawa

unread,
May 23, 2013, 4:23:14 AM5/23/13
to sphin...@googlegroups.com
Hi Richard,

2013/5/23 Richard Duivenvoorde <rduive...@gmail.com>:
> Looking in the source code, it seems to me that the pages from
> 'html_additional_pages' are not created using a 'context'?
>
> Does that mean that I am not supposed to use source files for that pages?

Yes.
html_additional_pages did not have context, it is not depending to
any reST source.

> Or in other words: how do I define the sources for custom layout pages in
> rst (not in the templates)

I think there are few options for achieving the purpose.

A. Use sphinx-1.2(b1) that supports {%trans%} tag for i18n [1]_.

B. Customize the layout.html to use a special HTML structure in a
particular page
by using pagename variable [2]_ in the layout.html template.

C. Write extension to generate target page with specialized template.
I think html-collect-pages [3]_ is matching your purpose.

.. [1] https://bitbucket.org/birkenfeld/sphinx/src/72dceb3/doc/_templates/index.html
.. [2] http://sphinx-doc.org/templating.html#pagename
.. [3] http://sphinx-doc.org/ext/appapi.html#event-html-collect-pages

Regards,
--
Takayuki SHIMIZUKAWA
http://about.me/shimizukawa
Reply all
Reply to author
Forward
0 new messages