Re: [sphinx-users] Providing an "online link" in the page footer

2020-08-24 Thread Luc Saffre
Thanks, Matt.  I got inspired by your idea and now use this::

  {%- set url = "https://www.example.com/; + (pagename[:-5] if
pagename.endswith('index') else pagename +"/") -%}
  Online link: {{url}}.

Your example worked on the master page but not on the lower level
directories.

Luc


On 21.08.20 14:57, Matt from Documatt wrote:
> Hello Luc,
> I use the following to "am I on the master page?" (usually file
> index.rst).
>
> Somewhere near to the top of template I define (in action
> <(https://gitlab.com/documatt/sphinx-themes/-/blob/master/sphinx_documatt_theme/sphinx_documatt_theme/layout.html#L8)>):
>
> {%- set ismasterdoc = pagename == master_doc -%}
>
> Later:
>
> {% if ismasterdoc %}
>   https://www.lino-framework.org/;>Online link
> {% else %}
>   https://www.lino-framework.org/{{ pagename|e }}/">Online
> link
> {% endif %}
>
> Matt
> https://blog.documatt.com/sphinx-theming/index.html
>
> On Tue, Aug 18, 2020 at 5:01 PM Luc Saffre  > wrote:
>
> Hello,
>
> in my footer template I usually have something like this::
>
>   https://www.lino-framework.org/{{ pagename|e }}.html"
> >Online
> link
>
> It's practical for me because usually I watch the generated output
> in my local build, but sometimes I want to see the published
> version of it.
>
> The trick works perfectly for me, except on sites where I use the
> dirhtml builder
> 
> .
> On such a site a can remove the ".html" in the href::
>
>   https://www.lino-framework.org/{{ pagename|e }}"
> >Online
> link
>
> which works for most pages, but *not* for the index.rst page of a
> directory. Any thoughts on this?
>
> Luc
> -- 
> 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 sphinx-users+unsubscr...@googlegroups.com
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/sphinx-users/85e0e0a5-5334-fae1-db3c-c9ad2046fc70%40gmail.com
> 
> .
>
> -- 
> 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 sphinx-users+unsubscr...@googlegroups.com
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/CAOGNDW8HYoQUc4LkMgnJxoUBn7AsRHHxh4HnRDvBR0ex3c80Xg%40mail.gmail.com
> .

-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/211e661a-e6bc-3565-76be-f601e3bf1480%40gmail.com.


Re: [sphinx-users] Providing an "online link" in the page footer

2020-08-21 Thread Matt from Documatt
Hello Luc,
I use the following to "am I on the master page?" (usually file index.rst).

Somewhere near to the top of template I define (in action
<(https://gitlab.com/documatt/sphinx-themes/-/blob/master/sphinx_documatt_theme/sphinx_documatt_theme/layout.html#L8)>
):

{%- set ismasterdoc = pagename == master_doc -%}

Later:

{% if ismasterdoc %}
  https://www.lino-framework.org/;>Online link
{% else %}
  https://www.lino-framework.org/{{ pagename|e }}/">Online link
{% endif %}

Matt
https://blog.documatt.com/sphinx-theming/index.html

On Tue, Aug 18, 2020 at 5:01 PM Luc Saffre  wrote:

> Hello,
>
> in my footer template I usually have something like this::
>
>   https://www.lino-framework.org/{{ pagename|e }}.html"
> >Online
> link
>
> It's practical for me because usually I watch the generated output in my
> local build, but sometimes I want to see the published version of it.
>
> The trick works perfectly for me, except on sites where I use the dirhtml
> builder
> .
> On such a site a can remove the ".html" in the href::
>
>   https://www.lino-framework.org/{{ pagename|e }}"
> >Online link
>
> which works for most pages, but *not* for the index.rst page of a
> directory. Any thoughts on this?
>
> Luc
>
> --
> 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 sphinx-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/85e0e0a5-5334-fae1-db3c-c9ad2046fc70%40gmail.com
> 
> .
>

-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAOGNDW8HYoQUc4LkMgnJxoUBn7AsRHHxh4HnRDvBR0ex3c80Xg%40mail.gmail.com.


[sphinx-users] Providing an "online link" in the page footer

2020-08-18 Thread Luc Saffre
Hello,

in my footer template I usually have something like this::

  https://www.lino-framework.org/{{ pagename|e }}.html">Online
link

It's practical for me because usually I watch the generated output in my
local build, but sometimes I want to see the published version of it.

The trick works perfectly for me, except on sites where I use the
dirhtml builder
.
On such a site a can remove the ".html" in the href::

  https://www.lino-framework.org/{{ pagename|e }}">Online link

which works for most pages, but *not* for the index.rst page of a
directory. Any thoughts on this?

Luc

-- 
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 sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/85e0e0a5-5334-fae1-db3c-c9ad2046fc70%40gmail.com.