Comments (11)
Does not seem to provide a method to override.
from sphinx-material.
Can you be a bit more specific? In particular, can you posted the relevant parts of your conf and the rst page?
from sphinx-material.
Hmm, I'm not sure I get what you mean, but here is my a test.rst
file:
file without header/title.
And here are the relevant parts of the config.py
:
import sphinx_material
project = 'Kune'
release = '0.1'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx_copybutton',
]
html_sidebars = {
"**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]
}
extensions.append("sphinx_material")
html_theme_path = sphinx_material.html_theme_path()
html_context = sphinx_material.get_html_context()
html_theme = "sphinx_material"
html_theme_options = {
'nav_title': 'Kune servers documentation',
'globaltoc_depth': 3,
'globaltoc_collapse': True,
'globaltoc_includehidden': True,
}
Using this configuration, the resulting HTML tag is <title><no title> — Kune 0.1 documentation</title>
.
I would like to know how to make the resulting tag <title>Kune 0.1 documentation</title>
or any other title I could decide to be the default title for no-headings-pages.
EDIT, also, I guess you already know that, if I set html_title = "Another title"
I'll get <title><no title> — Another title</title>
which doesn't solve the "<no title>"
problem.
from sphinx-material.
This seems to be Sphinx's default for a page with no title. This "title" (<no title>
) is then passed to the template engine which is then rendered in place fo the title.
This could be addressed here, but it may not be the right place for a fix. Sphinx might be the right place to have an option to override the default value of <no title>
to be an empty string.
Normally the title is read from the pages top heading.
from sphinx-material.
Thanks, I'll move this to sphinx then and patch it on my side in the mean time.
from sphinx-material.
Great. I'd rather not try and fitis here since it would be pretty hacky, something along the lines of
if title =! "<no title>":
full_title = title + " - ' + html_title
which is very dependent on how sphinx renders "no title". I would suggest that Sphinx could add an enhancement for conf.py that would be something like include_empty_page_title
which would be True
or False
. Alternatively, it could just have a default page title, e.g., default_page_title = ""
which would then be reasonable to filter for so that title would only be added when not-empty.
from sphinx-material.
That patch is not enough sadly, there is another place that treats title apparently.
Here is how I patched it (at least to remove the <no title>
part), in my conf.py
:
from docutils import nodes
from sphinx.application import Sphinx
from sphinx.environment.collectors.title import TitleCollector
_process_doc = TitleCollector.process_doc
def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
if doctree.traverse(nodes.section):
_process_doc(self, app, doctree)
else:
titlenode = nodes.title()
app.env.titles[app.env.docname] = titlenode
app.env.longtitles[app.env.docname] = titlenode
TitleCollectorprocess_doc = process_doc
This renders — test
, for now I can't get rid of the —
.
Another problem is that, even with setting a title manually in the toctree: A test .rst without any section <test>
, the entry doesn't show.
from sphinx-material.
The - removal would need to come from sphinx-material. If title is empty, then the page title should be html_title if present, and it not, nothing (which might not be 100% compliant in HTML).
from sphinx-material.
The title wouldn't be empty, it would be equal to html_title
. Here the problem is that it's equal to f"— {html_title}"
.
from sphinx-material.
That is what I mean. One challenge is that html_title has been escaped before it get to templating and the - has been manually inserted, and so some string parsing is needed. Not the end of the world, but starting to feel fragile. This hardcoded behaviour is a misfeature of Sphinx IMO.
from sphinx-material.
There is a start in#81. It will need to become opt-in before it can be merged.
from sphinx-material.
Related Issues (20)
- Allow arbitrary colors for "color_primary" HOT 2
- Documentation for "logo_icon" HOT 3
- ENH: allow for image file as `logo_icon`? HOT 2
- html_minify doesn't work with the 'dirhtml' builder HOT 1
- Avoid stripping table classes HOT 8
- Permalink buttons are invisible HOT 1
- One extra character has gray background in inline :code:`Foo` HOT 1
- 0.0.35: sphinx fails with call trace in `sphinx_material/__init__.py`
- 0.0.35: `pytest --black` fails
- Google HOT 1
- weird rendering of longtable in material
- Toctree not shown in sidebar HOT 1
- High contrast color scheme option
- Search results shows up with Please activate JavaScript ... error HOT 10
- Translation
- default localtoc title quotes
- Can't get my logo to show up in the header HOT 1
- Extension broken since Sphinx 7.2.0
- Tag the 0.0.36 release HOT 1
- FUTURE: sphinx-material's future
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sphinx-material.