Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add templates for generated pages #3

Open
melissawm opened this issue May 18, 2022 · 4 comments
Open

Add templates for generated pages #3

melissawm opened this issue May 18, 2022 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@melissawm
Copy link
Owner

melissawm commented May 18, 2022

Highest priority is to set up templating for the tags overview page.

@melissawm melissawm added this to the 0.1 milestone Aug 22, 2022
@melissawm melissawm added the enhancement New feature or request label Aug 22, 2022
@melissawm melissawm modified the milestones: 0.1, 0.2 Oct 8, 2022
@nebelgrau77
Copy link
Contributor

How would that work? I still know very little about Sphinx, so I'm not sure how you intend this.

@melissawm
Copy link
Owner Author

I was thinking to use some sort of templating to configure the look and feel of the tags overview page. For example: https://stackoverflow.com/questions/13209597/override-html-page-template-for-a-specific-sphinx-document

I tried looking for solutions but I don't have any specific ideas right now.

@nebelgrau77
Copy link
Contributor

Yeah, I get the template idea, I have some minor modifications like that in my project (some are pretty difficult to implement, e.g. if you want your logo in the sidebar to be below the title - no problem! but to have it above it I ended up making a single logo+title png file :D)
But would you like to add some templates for the users to choose from, or somehow have the extension to generate them?

@melissawm melissawm removed this from the 0.2 milestone Jan 28, 2023
@JWCook
Copy link
Collaborator

JWCook commented Jul 11, 2023

I would find this useful as well.

Style

templating to configure the look and feel of the tags overview page

For customizing style, that can already be done on the user's end with Sphinx's html_css_files option.

Content

Instead of making HTML templates, this could be done with 4 small markup templates:

  • Tags overview (rST)
  • Tag page (rST)
  • Tags overview (MyST)
  • Tag page (MyST)

This would basically replace what sphinx-tags currently does in Tag.create_file() and Entry.tagpage().

Extension example

Here's an example for the autosummary extension, with both the directive code and template files: https://github.com/sphinx-doc/sphinx/tree/master/sphinx/ext/autosummary

Jinja example

Here's a quick (probably incorrect, but close enough) example of what a MyST template for tagsoverview.md might look like:

(tagoverview)=
# {{ tags_overview_title }}

{% raw %}
```{toctree}
{% endraw %}
---
caption: {{ tags_index_head }}
maxdepth: 1
---
{% for tag in tags %}
  {{ tag.name }} ({{ len(tag.items) }}) <{{ tag.name }}>
{%- endfor %}
```

@melissawm melissawm added this to the 0.4.0 milestone Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants