-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Index pages #13
base: master
Are you sure you want to change the base?
Index pages #13
Conversation
with information based on `.example.yml` files that describe each example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain how and where the markers will be used? Note that we should not put those markers inside of examples themselves, because examples must at all times be self-contained and runnable standalone, so they can be downloaded and run.
If we only use those markers for overview pages that are not part of examples, it might be a good tool. However, what index pages are there? We likely only need a single top-level page for branching into examples, and inject a link into examples to return to the overview. At least from the top of my head.
One question I have not wrapped my head around yet is how to create index pages for the tags without pre-defining what tags exist. Same for authors. I might have a peek at how this is implemented in the blog plugin.
I'm not exactly sure what you mean.
Ah, sorry, should have mentioned that. The markers would go into the documentation for the whole set of examples, so The kinds of tags I have imagined we'd use:
If you think we should stick with a single page then we could add classes to these and let people selective hide things by tag - rather than having separate index pages. That might actually make more sense. |
To be honest, it sounds a little like we're reinventing a categorization system for the third time 😉 We already have tags and categories in blogs. If you think that it is necessary, we can go ahead, but I only want to bring up this point, since it feels like we're reinventing the wheel. IMHO, at first, sticking to a single page and moving things under certain sections sounds like a less overengineered approach at the current stage. Take our plugins page for example – we have 12 plugins in three categories. I'm not sure how many examples we have right now, but it's definitely of the same magnitude. Thus, I'd say: keep it simple and we'll consider tagging once we gravitate towards I'm absolutely fine starting with a lean approach quickly, and reconsidering as we grow. We've followed the same approach successfully on our documentation. To put it more graphically: documentation is like a plant – you should repot it from time to time. Disclaimer: this quote is not from me, but from somebody from Twitter (can't remember who) |
code maintenance: - added missing encoding to open (PyLint W1514) - removed f-strings from log statements (PyLint W1309) - reorganized imports (PyLint misc) - removed use of global variable (PyLint W0603) - avoiding use of 'type' as a variable name
Hi, I have pushed some changes to this branch and also merged in changes from master (which, IIRC was the At the moment, there are only two examples on there as only two have complete I am rendering the tags as I think they convey important information, especially the public/insiders distinction. We should have a discussion about how filtering by them might work. There is the question how we should order the examples on the index page, which is of particular importance if we have no way to filter them. One thing I would like to do is to provide author information for the examples, partly to get some exposure but also to encourage others to contribute. I note the discussion about what the ambassadors could get credit for - perhaps this would be something to offer? Just a thought. |
I'm currently short on time verifying this, but if you're confident that it works, I can merge this through. Having an index page that might not be perfect yet is better than having no index page
That is a very interesting idea, but we'd first see how it goes with discussions, and we're still in iteration-mode on the examples repository. Once our process reaches maturity here, we can for sure onboard individuals to contribute examples and get compensated with Insiders access. That being said, you can definitely explore how we could incorporate author information, so we can leverage it later on. |
using a custom template instead of generating HTML code in the hook, looking much tidier as a result.
I don't want to extend this for too long but did some work on filtering the examples. It would be good if you could have a look - not for correctness of the implementation but to see if you think the overall approach is ok. I do still need to add a "show all" button. The logic is implemented in CSS at the moment, turning off examples that match a filter that is turned off, which at the moment means the user has to tick all the pills that match an example they want to find. This seemed to make sense when thinking about a query like "show me all the examples for the blog plugin in the public version". Not sure it captures all uses, though. I had an issue with the One other thing I thought would be good was to move the example metadata into the headers of the |
Right, I forgot: also need to decide how the produce a short description of the example for the list. One approach would be to mandate that there be a |
I'll take a look.
That's perfectly fine. |
Okay, so honestly Im not really a fan of the filtering logic yet. I have to switch on all filters to get results, and there will likely be much more tags when we have more examples. I'd say for now, we go without filters and list the examples on the top-level page. Let's first build 40-50 examples and then decide how we make those more accessible. Remember, example should be linked from the documentation, which is considered the primary entrypoint. |
Ok, will park the filter logic somewhere. Perhaps just commenting it out in the template? I assume the rendering of the examples as such is ok? What do you think about the description? Should this live in the header of the |
We could just parse the content from the corresponding README.md, but I'd say this is something for later. Let's keep it as lean as possible right now. I'll revisit this topic later and we'll find a good solution together. For now, we should concentrate on the actual examples. |
I would like to take up our discussion of the tags again. It seems to me that it should be possible to tweak either or both the tags and project plugins to aggregate the tags over multiple sub-projects. If that was supported, it would be easy to just equip the Any further improvement such as grouping tag index content by the other tags used (as in squidfunk/mkdocs-material#6443) would then also benefit out index here, which, in turn, can serve as a test-case. If this is not something you would slip in between other work when you want to take an 'active break', I would be happy to have a go. It would seem to me worthwhile because it adds value to projects, tags and blog, all in one go - as well as resolving this open discussion here! If you want to do this as a quick win then I will just plod on with the other things I already have taken on and finish some of them off. Will start with the simplified index page here. Should not take that long and be with you tomorrow. |
It just strikes me that I need to study the existing plugins to see if the hook in our parent project here is not entirely superfluous if we can do what I suggested above. It might reduce down to a simple check to see if all |
The problem is that investing into the tags plugin makes no sense at the current stage. It was the first plugin I wrote, when I was new to Python and just learned how to write MkDocs plugins. I have several ideas how to make the tags plugin much more powerful. I also have a working prototype, but it's not yet production ready. The general idea is to remove the tags index entirely and allow to use markers to create an arbitrary number of tags index that are link targets (so tags link to the closest index). Currently, there can only be a single index to link to – all extra tags indexes have no links. I'll bump it up my – as you love to call it – guilt pile 😅 I will check whether I can finish a good prototype soon, so we can take it for a spin. Before, we need to understand how to integrate both plugins, so we can automatically collect tags from projects and link to them in indexes.
Jup, might be a good idea, but might also not be – the metadata will show up in the README.md when viewed on GitHub, and might be confusing. I'm not sure what's better. However, we could add a preprocessing step via a custom transform to set all metadata from the |
For a moment I thought the meta pluging could put the tags into the Markdown but then it would be in all pages and would get in the way when we warn to showcase the meta plugin itself. So, some custom code to hoist from Btw. where should the README file live? (Sub-)project root or |
I really like your thinking – however, it's kind of a non-use case for the meta plugin, because we would need some functionality to only apply to a specific file or level, and that would defeat the whole case, so the transform is probably a better idea. It is explicitly intended to make changes to projects before building them without touching the projects themselves. Sometimes you cannot touch the projects, as you're building docs inside git submodules that you might not govern, or similar use cases.
In the root of the |
oh, right, so no need for symlinks. This is documented behaviour, too:
|
Okay, let me draw something off my guilt pile today – oh look! It's the tags plugin! I'll invest the day into checking if I can finish the rewrite fast, as it's quite far actually, and we can at least close the open issue. We will definitely need to think about how to integrate the tags plugin with the projects plugin, since you want to link tags from different projects, so this is something I will definitely keep in mind when finishing my prior work. It would be really awesome to build an overreaching tags index, essentially sourcing tags from other sites. This might be possible by emitting something like a |
I made substantial progress 🥳 Still not ready for a spin, but I think I'll get there tomorrow. I will open a PR on the Insiders repository as soon as this is ready for testing, so we can gravitate towards a sensical solution together. Now:
That's just from the top of my head. In essence, we'll be introducing several new degrees of freedom that will make the tags plugin an excellent companion for building second-level structures besides the navigation structure. I'm curious what you think about that and if you have further ideas that we should consider to evaluate. |
This looks great. Might take a bit of time for me to wrap my head around all the use cases and implications. I would love to test-drive this in One thought I had was how the tags functionality might work with the 'related links' in the blog plugin? More generally speaking, would it make sense to have a related-tags function? Imagine, for example, pages tagged with 'customization'. A related tag might be 'plugins', 'hooks'? These are distinct, at least in current parlance, but are all related to "how do I get what I need out of Material and MkDocs?" |
It's a next step. As I've written, we first need to expose the tags of a project via something like
Sounds a lot like squidfunk/mkdocs-material#6463 to me, and the answer is yes. However, we don't even need to explicitly define the relation but can use relative co-occurrence to derive degree of relatedness. We're essentially building a bipartite graph of pages and tags. |
I've distilled our conversation into squidfunk/mkdocs-material#6517. Let's collect some feedback and user input along the way. |
Added mechanism to create index pages with information based on
.example.yml
files that describe each example. The code is loosely based on the shortcodes mechanism used in the documentation plus thearchive.py
hook.Would like to know if you think this is going roughtly in the right direction or if I am off track here.
One question I have not wrapped my head around yet is how to create index pages for the tags without pre-defining what tags exist. Same for authors. I might have a peek at how this is implemented in the blog plugin.