ablog icon indicating copy to clipboard operation
ablog copied to clipboard

ABlog support for furo theme

Open damian-krawczyk opened this issue 3 years ago • 19 comments

Description

Hi, I would like to use ABlog with furo theme, but I'm encountering an error:

Here simple example with alabaster theme (works with ablog): https://sphinx-ablog-alabaster.readthedocs.io/en/latest/ https://github.com/damian-krawczyk/sphinx-ablog-alabaster conf.py : html_theme = 'alabaster'

Here simple example with pydata_sphinx_theme (works with ablog) https://sphinx-ablog-pydata-sphinx-theme.readthedocs.io/en/latest/ https://github.com/damian-krawczyk/sphinx-ablog-pydata_sphinx_theme conf.py : html_theme = 'pydata_sphinx_theme'

Here simple example with furo (doesn't work with ablog, see error) https://sphinx-ablog-furo.readthedocs.io/en/latest/ https://github.com/damian-krawczyk/sphinx-ablog-furo conf.py : html_theme = 'furo'

The only difference in listed repositories is mentioned config.

I've already raised issue for furo but before I get back to them I would like to get feedback from you to make sure that this is not something to be fixed on your side?

damian-krawczyk avatar Jul 13 '21 20:07 damian-krawczyk

Ah I see its from the URL. I missed that.

Honestly, I have no real idea where to start with that error.

nabobalis avatar Jul 13 '21 20:07 nabobalis

commented on the furo issue, but it looks like that theme doesn't allow using layout.html. luckily, only two places it's referenced in ablog: https://github.com/sunpy/ablog/search?q=layout.html

sudopluto avatar Jul 19 '21 18:07 sudopluto

I don't know much about the Sphinx template system (I just started tried to setup a blog with furo theme).

Tried to extend page.html and redirect.html from furo's page.html instead of layout.html seemed to work for both listings and redirections. It also seemed to keep working with alabaster theme.

Tried that with this patch and @damian-krawczyk 's PoC https://github.com/damian-krawczyk/sphinx-ablog-furo patch_to_make_ablog_work_with_furo.diff.txt

I don't know if this will break other themes or end users installations.

I don't propose a PR directly because I don't understand either why Sphinx Doc proposed different layout.html and page.html templates and how each one is supposed to be used (if someone could post an explanation, that would be interesting).

And I have no idea either of which option is the best for this issue:

  • make ablog use page.html (this patch)
  • make juro allow users and extensions to override layout.html
  • setting an option in ablog to allow users select which base template it's going to be overriden (https://github.com/wpilibsuite/sphinxext-rediraffe seems to do something like that with their rediraffe_template configuration option)
  • ...

jmones avatar Aug 15 '21 10:08 jmones

The previous patch was wrong... Didn't work when I tried to use it in a more complex example. This seems to be better: patch_to_make_ablog_work_with_furo_take_2.diff.txt

jmones avatar Aug 15 '21 21:08 jmones

At furo's end Issue moved from Issues to Discussions by @pradyunsg https://github.com/pradyunsg/furo/discussions/262

damian-krawczyk avatar Sep 29 '21 19:09 damian-krawczyk

@nabobalis Can you check furo's comment?

https://github.com/pradyunsg/furo/discussions/262#discussioncomment-1656466

damian-krawczyk avatar Dec 19 '21 13:12 damian-krawczyk

@nabobalis Can you check furo's comment?

pradyunsg/furo#262 (reply in thread)

I see, if someone wants to fix this assumptions, I am happy to accept the patch.

nabobalis avatar Dec 19 '21 18:12 nabobalis

Is anyone working on this? @nabobalis I can try to contribute.

stonecharioteer avatar Jan 21 '22 06:01 stonecharioteer

Is anyone working on this? @nabobalis I can try to contribute.

I am not aware that anyone is working on it. If you want to try to help, please go ahead.

nabobalis avatar Jan 21 '22 06:01 nabobalis

I've proposed an approach for solving this problem, at scale, in #125 that I think will be more sustainable for all the maintainers involved.

pradyunsg avatar Jan 21 '22 09:01 pradyunsg

Doesn't this issue seem to be fixed? I can reproduce it on sphinx 6.2.1 + ablog 0.11.6 + furo 2024.

  • Demo: http://silverrainz.me/ablog-demo/
  • Source: https://github.com/SilverRainZ/ablog-demo

SilverRainZ avatar Jan 30 '24 05:01 SilverRainZ

I found that there are still {%- extends "!layout.html" %} in ablog/redirect.html:

https://github.com/sunpy/ablog/blob/de37cf013846ceccae0e9e478f4ed6e1bd2dd0d3/src/ablog/templates/ablog/redirect.html#L1

SilverRainZ avatar Jan 30 '24 05:01 SilverRainZ

I should add a test build to check compatibility with furo.

nabobalis avatar Jan 30 '24 22:01 nabobalis

@nabobalis Any plan to fix it? I have no idea how to do that :'(

SilverRainZ avatar Feb 02 '24 13:02 SilverRainZ

I will try but I won't promise an ETA.

nabobalis avatar Feb 02 '24 17:02 nabobalis

I still see the “layout.html” problem as well.

ERROR: This page was generated by inheriting from "layout.html".

Furo (the documentation theme that this site is generated with) does not support this, and has generated this page. If you are the author of this documentation, please look into why this page was generated using the "layout.html" template and fix the root cause.

Debugging information, if you need to report this error somewhere:
Sphinx: 7.2.6
Furo: 2024.01.29

pagename: index

This is with Ablog 0.11.6. The moment I set the template to Furo when Ablog is enabled, I get this problem. If I change either the theme or disable the Ablog extension, the problem goes away.

Jaharmi avatar Mar 04 '24 01:03 Jaharmi