On Saturday, 7 November 2015 09:04:47 UTC-4, André wrote:
>
> I'm creating a multi-page document in two different languages (English and 
> French).  The url of a given document will take the form of   
> prefix/en/name.html  or prefix/fr/name.html  i.e. only the "en" or "fr" 
> part will be different.  Is is possible to include some code in the main 
> template (layout.html  ... or elsewhere?) that would take the url of the 
> current (English) document, replace "/en/" by "/fr/" and insert it as a 
> link to the "French" version?  Something like
>
> retrieve some/prefix/en/this_document.html  ->  <a 
> href="some/prefix/fr/this_document.html">Français</a>
>
>
I essentially found the answer I needed in this post: 
https://groups.google.com/forum/#!topic/sphinx-users/Xmbs5AbnVKY

Basically, what I do is insert the following:

    <a href="{{pathto("../en/"+pagename)}}">{{"English version"}}</a>

where needed in layout.html.

 

> André
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to