Skip to content

Make the theme responsive #46

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

Merged
merged 24 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python_docs_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ <h3>{{ _('Navigation') }}</h3>
<span></span>
</label>
<nav class="nav-content" role="navigation">
<img src="{{ pathto('_static/' + 'py.svg', 1) }}" alt="Logo"/>
<a href="{{ pathto('index') }}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pathto(master_doc) would be more appropriate here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or does CPython documentation use contents for the toctree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for such a quick review! :) I know what I added doesn't work for sure. Let me try pathto(master_doc).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need help!
I don't know how to add the correct link to the docs.python.org/3.9/.
In line 88 in layout.html I added <a href="{{ pathto(theme_root_url) }}" , and it creates file:///.../doc-html(3)/3.9/https://www.python.org/.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't wrap it in pathto, just {{ theme_root_url }} is enough.

That should fix it. :)

Copy link
Member

@pradyunsg pradyunsg May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other words, that is behaviour I'd expect and I thought that's what you wanted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was confusing the two kind of links (to the docs home and the language/framework home). On the sites I used a lot lately (eg Vue.js) the style of the framework home page and the style of the documentation homepage are the same. And it feels like I just go to the documentation home, not the general home, when I click on the logo.

But you are right, now we have the correct behavior, linking to python.org.

We still don't have a way of going to the documentation homepage, docs.python.org/3 from other pages on mobile. Is it necessary to add it, and add it in this PR specifically?

Copy link
Member

@pradyunsg pradyunsg May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to have a link to the documentation homepage, that'd be {{ pathto(master_doc) }} or {{ pathto("index") }}. No need for a |e on either of them.

Copy link
Member

@pradyunsg pradyunsg May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, this feels like something we can do in a follow up PR.

I'd really like to push for getting this landed soon, so that we can start moving other things forward without needing to come back and update this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, let me know if I need to change anything? I would be happy to get this landed soon, too!

<img src="{{ pathto('_static/' + 'py.svg', 1) }}" alt="Logo"/>
{{ shorttitle }}
</a>
<div class="version_switcher_placeholder"></div>
{%- if pagename != "search" and builder != "singlehtml" %}
<form id="searchbox" role="search" class="search" action="{{ pathto('search') }}" method="get">
Expand Down
4 changes: 4 additions & 0 deletions python_docs_theme/static/pydoctheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ dl > dt span ~ em {
font-family: monospace, sans-serif;
}

.toctree-wrapper ul {
padding-left: 20px;
}

@media (max-width: 1023px) {
/* Body layout */
div.body {
Expand Down