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

How to provide extracopyright #81

Closed
duncanmmacleod opened this issue Apr 29, 2022 · 12 comments · Fixed by #103
Closed

How to provide extracopyright #81

duncanmmacleod opened this issue Apr 29, 2022 · 12 comments · Fixed by #103
Labels
documentation Improvements or additions to documentation

Comments

@duncanmmacleod
Copy link
Contributor

I've just discovered this project, and love it (I have used sphinx-material for a while, but this gets much closer to mkdocs-material), thanks for maintaining it!

But, I can't work out how to provide extracopyright in a way that actually get's built into the rendered docs. I've put together a tiny demo here

https://github.com/duncanmmacleod/test-sphinx-immaterial

but nothing I put in my _templates/layout.html seems to have any effect. Is this possible?

@jbms
Copy link
Owner

jbms commented Apr 29, 2022

You should override it in _templates/partials/footer.html instead, I believe.

@duncanmmacleod
Copy link
Contributor Author

You should override it in _templates/partials/footer.html instead, I believe.

Ok, looking at it I think modifying partials/copyright.html would be easier.

But, this does ask the question of why there's a custom block extracopyright if it can't be used? I also see extrafooter defined in partials/footer.html - I presume, but haven't tested, that this similarly can't be used?

@2bndy5
Copy link
Collaborator

2bndy5 commented May 3, 2022

Ok, looking at it I think modifying partials/copyright.html would be easier.

I think you're correct. Please let us know your findings when you can.

The extracopyright block seems to have been inherited from sphinx-material theme, and it may be one of the relic features that hasn't been tested thoroughly in this theme. We're still working toward a stable state, so you're feedback will likely make it into the docs if/when this is solved. The docs about customizing templates for this theme were also inherited from sphinx-material theme and haven't seen much alterations either.

Risking what might be obvious to you, here is a link to the sphinx docs about customizing the theme templates.

@2bndy5
Copy link
Collaborator

2bndy5 commented May 3, 2022

oh, this seems troubling

{%- if False %}{%- block extracopyright %}{%- endblock extracopyright %}{% endif %}

The if False seems to have been merged in from updates in mkdocs-material repo. I have to brush up on jinja syntax, but I suspect the False constant may be preventing extracopyright from being used.

EDIT: This doesn't seem to be a problem. Please disregard.

@2bndy5
Copy link
Collaborator

2bndy5 commented May 3, 2022

ok, using the latest release of this theme, I was able to add content to the footer.

template override

create a file named footer.html in a directory called partials under your docs/_templates

docs
└ _templates
  └ partials
    └ footer.html

extend the theme's partials/footer.html and override the extracopyright block.

{% extends "!partials/footer.html" %}
{% block extracopyright %}
  <p>EXTRA COPYRIGHT</p>
{% endblock %}

now build your docs. For me, this resulted in
image

@duncanmmacleod
Copy link
Contributor Author

I think you're correct. Please let us know your findings when you can.

Overwriting the copyright.html partial works just fine.

Thanks for the neat solution extending the footer partial, that sounds like the 'official' solution to the problem.

@duncanmmacleod
Copy link
Contributor Author

It looks like mkdocs-material removed their extracopyright support for v8, so I presume overwriting copyright.html will be the best solution for upstream compatibility.

@2bndy5
Copy link
Collaborator

2bndy5 commented May 3, 2022

re-opening as a reminder to adjust the docs.

@duncanmmacleod can point me to how you ended up doing this? The link in OP hasn't seen any modifications.

@2bndy5 2bndy5 reopened this May 3, 2022
@2bndy5 2bndy5 added the documentation Improvements or additions to documentation label May 3, 2022
@duncanmmacleod
Copy link
Contributor Author

@duncanmmacleod can point me to how you ended up doing this? The link in OP hasn't seen any modifications.

I have updated the example repo with a solution: https://github.com/duncanmmacleod/test-sphinx-immaterial/tree/79431161a9944890d48e3fb047f0712317a410f0.

@duncanmmacleod
Copy link
Contributor Author

For full disclosure, my application here is to generate linked extensions for mkdocs-material and sphinx-immaterial that provide a common documentation theme across both sphinx and mkdocs projects. So my preferred solution is the one that can be implemented in both projects in as similar a way as possible, and since mkdocs-material dropped extracopyright, I favour the partial solution over the block one.

@2bndy5
Copy link
Collaborator

2bndy5 commented May 3, 2022

It looks like mkdocs-material removed their extracopyright support for v8

That explains the sphinx-immaterial specific comment in footer.html All the more reason to add a solution for this to our docs.

<!-- sphinx-immaterial: Define extracopyright block for inclusion in child template -->
{%- if False %}{%- block extracopyright %}{%- endblock extracopyright %}{% endif %}

The if False change happened when we merged in changes from upstream v8


My partials/*.html solution may be "hacky" because I threw it together in proof-of-concept effort.

@2bndy5
Copy link
Collaborator

2bndy5 commented May 3, 2022

Note to self: Change the copyright year for this theme's docs.

2bndy5 added a commit that referenced this issue May 21, 2022
@2bndy5 2bndy5 mentioned this issue May 21, 2022
2bndy5 added a commit that referenced this issue May 21, 2022
fix more typos in example snippets
@jbms jbms closed this as completed in #103 May 21, 2022
jbms pushed a commit that referenced this issue May 21, 2022
fix more typos in example snippets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants