Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

JuroOravec
Copy link
Collaborator

@JuroOravec JuroOravec commented Aug 16, 2025

A lot of changes on the documentation site, so it can grow further:

2-level tabs navigation

I overrode how material theme (mkdocs-material) displays the tabs at the top of the page. Now, we can introduce a 2-levels of tabs:

When user hovers or clicks on the "Documentation" tab, instead of navigating to a page, a second level of tabs shows:

Collapsed:
Screenshot 2025-08-16 at 15 37 21

Expanded:
Screenshot 2025-08-16 at 15 47 44

I moved documentation related sections inside the umbrella "Documentation" tab, creating more space for other sections.

Some other sections which I can imagine being added in the future:

  • "Home" - flashy landing page with showcase of the features
  • "Blog" - Blog section for sharing non-code updates.
  • "Documentation > Migrating to Components" - Section with tutorials on how to move from other libraries (or vanilla Django) onto components

And this is how the 2-level tabs look in the sidebar navigation:

Screenshot 2025-08-16 at 16 01 42

Examples section

Prepared a section where we can post examples or 3rd party components:

Screenshot 2025-08-16 at 16 36 47 Screenshot 2025-08-16 at 18 38 47

Community sections have own tab

Screenshot 2025-08-16 at 18 37 50

With this, the "Overview" section got slimmer.

Screenshot 2025-08-16 at 18 36 44

Installation moved to Gettings started

Screenshot 2025-08-16 at 16 05 12

Release notes - each release has own page

I've made a script that parses the CHANGELOG and creates individual entries. Because some releases like v0.140 had tons of changes and huge write up on the release.

Screenshot 2025-08-16 at 18 08 38 Screenshot 2025-08-16 at 17 16 12

@JuroOravec JuroOravec changed the title docs: add 2-level tabs, add examples and plugins, move comunity, spli… docs: add 2-level tabs, add examples and plugins, move comunity, split release notes Aug 16, 2025
Copy link
Contributor

Performance Benchmark Results

Comparing PR changes against master branch:

Benchmarks that have stayed the same:

Change Before [373d5c7] After [1e16780] Ratio Benchmark (Parameter)
79.9±0.4ms 80.0±0.8ms 1 Components vs Django.timeraw_render_lg_first('django')
270±3ms 269±3ms 1 Components vs Django.timeraw_render_lg_first('django-components')

@@ -94,7 +94,7 @@

- Fix typo preventing benchmarking ([#1235](https://github.com/django-components/django-components/pull/1235))

## 🚨📢 v0.140.0
## v0.140.0 🚨📢
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved those warning emojis after the version, so things are nicely aligned in the docs on index page and navigation

## 🚨📢 v0.110
## v0.110 🚨📢

_25 Nov 2024_
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added date to older releases. When the date is included, in the format like _25 Nov 2024_, then the script that prepares the Releases section in the documentation will pick up on these dates, and append them to the release page title, so e.g. v0.110.0 becomes v0.110.0 (2024-11-25).

Screenshot 2025-08-16 at 18 08 38

- "Documentation: Concepts": concepts
- "Documentation: API Reference": reference
- "Documentation: Guides": guides
- "Documentation: Upgrading": upgrading
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here you can see how to "2-level" tabs work - The section / tab name are actually like "Documentation: Concepts".

But when rendering the top navigation tabs, the trick I did was to split and group the tab names by prefixes. So all tabs that start with Documentation: will be stashed away under the Documentation top-level tab.

But in the remained of the app we still display these pages as they truly are, like "Documentation: Concepts". You can see that in the sidebar navigation, which have those full names:

Screenshot 2025-08-16 at 16 01 42

- Contributing: contributing.md
- Development: development.md
- Code of Conduct: code_of_conduct.md
- Dev Guides: devguides
Copy link
Collaborator Author

@JuroOravec JuroOravec Aug 16, 2025

Choose a reason for hiding this comment

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

All these sections were previously under Overview section, except for Dev guides, which were in Guides. I think this makes more sense, so that a new user doesn't have to go through all these when they are just trying to understand how the library works.


### Icons

- [djc-heroicons](https://pypi.org/project/djc-heroicons/) - Icons from HeroIcons.com for django-components.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My initial idea for the examples section was to be a place where we could put examplary component definitions (e.g. table, dialog, autocomplete, etc).

But in the documentation we've mentioned django-htmx-components and djc-heroicons. So instead of using that section solely for components, I decided to include also 3rd party libraries, grouped in some categories - similar to how you have the "awesome lists" on Github.

@@ -1,5 +1,6 @@
# `.nav.yml` is provided by https://lukasgeiter.github.io/mkdocs-awesome-nav
nav:
- Installation: installation.md
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Installation was moved as the first step of Getting started

Copy link
Contributor

Performance Benchmark Results

Comparing PR changes against master branch:

Benchmarks that have stayed the same:

Change Before [373d5c7] After [914d817] Ratio Benchmark (Parameter)
80.0±1ms 79.8±1ms 1 Components vs Django.timeraw_render_lg_first('django')
271±3ms 270±2ms 1 Components vs Django.timeraw_render_lg_first('django-components')

{# This overrides the nav-item partial from mkdocs-material v9.6.17 #}
{# https://github.com/squidfunk/mkdocs-material/blob/c89a66bf39bb7f472e925753367ff8e464e0d683/src/templates/partials/nav-item.html #}
{# Majority of the file is the original, so our changes are highlighted #}
{# with `OUR CHANGES START` and `OUR CHANGES END` #}
Copy link
Collaborator Author

@JuroOravec JuroOravec Aug 16, 2025

Choose a reason for hiding this comment

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

As this comment says, this is an override for mkdocs-material, and 99% of the file remains the same, only the render_content() macro was modified.

It's a bit annoying that we have to copy the whole file just to make a small styling tweak. But I don't think (not aware at least) if there's a cleaner way to do this. Ideally we could specify to override only the render_content macro.

</div>
</nav>

<script>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The script and style below are to make the opening of the sub-tabs smooth and cool. The behaviour is that:

  1. The sub-tabs will show when you hover over the top-level tab, and will hide again when you move cursor away.
  2. You can also click on the tab to ensure it remains open even after the cursor moves away. Second click closes it again.
Screen.Recording.2025-08-16.at.22.58.49.mov

@JuroOravec JuroOravec marked this pull request as ready for review August 16, 2025 21:07
Copy link
Contributor

Performance Benchmark Results

Comparing PR changes against master branch:

Benchmarks that have stayed the same:

Change Before [373d5c7] After [1837147] Ratio Benchmark (Parameter)
80.2±0.8ms 79.9±0.5ms 1 Components vs Django.timeraw_render_lg_first('django')
273±3ms 269±0.5ms 0.99 Components vs Django.timeraw_render_lg_first('django-components')

Copy link
Collaborator

@EmilStenstrom EmilStenstrom left a comment

Choose a reason for hiding this comment

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

Looks awesome! Nice addition.

@JuroOravec JuroOravec merged commit 8b9b937 into django-components:master Aug 18, 2025
16 checks passed
@JuroOravec JuroOravec deleted the jo-docs-2-level-tabs branch August 18, 2025 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants