mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-11-04 09:10:02 +01:00
Adjust components output (#2364)
This commit is contained in:
parent
7212f4beb1
commit
0af4104468
@ -21,10 +21,19 @@ def setup(app):
|
||||
def add_component_details(app, pagename, templatename, context, doctree):
|
||||
"""As each page is built, collect page details for the output."""
|
||||
if pagename.startswith("components/"):
|
||||
app.compoents_output[pagename] = {
|
||||
page_key = pagename[11:].replace("/", "_")
|
||||
component_name = pagename.split("/")[-1]
|
||||
page_data = {
|
||||
"title": context["title"],
|
||||
"url": context["pageurl"]
|
||||
"url": context["pageurl"],
|
||||
"path": context["pagename"],
|
||||
}
|
||||
if os.path.exists(os.path.join(app.builder.srcdir, "images", component_name + ".png")):
|
||||
page_data["image"] = app.builder.config.html_baseurl + "/_images/" + component_name + ".png"
|
||||
elif os.path.exists(os.path.join(app.builder.srcdir, "images", component_name + ".jpg")):
|
||||
page_data["image"] = app.builder.config.html_baseurl + "/_images/" + component_name + ".jpg"
|
||||
|
||||
app.compoents_output[page_key] = page_data
|
||||
|
||||
|
||||
def create_output(app, exception):
|
||||
|
Loading…
Reference in New Issue
Block a user