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

multiple instances? #feature_request #219

Open
alexvoss opened this issue Dec 13, 2023 · 10 comments
Open

multiple instances? #feature_request #219

alexvoss opened this issue Dec 13, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@alexvoss
Copy link
Contributor

Hi,

I am working on a template for creating blogs using Material for MkDocs and as part of this would like to use the fact that the blog plugin can be instantiated multiple times. This is both to show off the fact that it can and to be able to show different blog configurations.

Now, in the template, I am integrating the RSS plugin as well. Correct me if I am wrong but it does not support multiple instances itself, right? So, for the moment, only one of the blogs on the site will be included in the RSS.

It would seem sensible to me to add multi-instance support and I am willing to create a PR for this, though I realize that it might be a more complex one. I am also not entirely sure just how big a commitment this will turn out to be and when I might have enough clear road ahead to take it on but let's hope it is measured in weeks, not months.

Cheers, Alex

@Guts Guts added the enhancement New feature or request label Dec 16, 2023
@Guts
Copy link
Owner

Guts commented Dec 16, 2023

Hello @alexvoss ,

Not sure to get exactly what "multiple instances" mean. You would like to have a feed per subfolder for example?

Can you give an example or a hyperlink please?

Is your use case for production or demonstration (material examples repo) purpose?

FYI I'm actively working on better integrations support. You can have a look to the first step with Social Cards of Material theme on this PR #217. If you start to work on your own, I would recommend you to start from this branch.

@alexvoss
Copy link
Contributor Author

Sorry, should have included a link or description. If a plugin supports multiple instances, this means that they can be used multiple times in the same configuration file, allowing to fine-tune behavior for separate sections of your project.

The blog plugin is one of those in Material that supports multiple instances. You might have a blog for news and one for tips, for example. These would have different configurations such as different blog_dir attributes, so the two can be separately managed.

Ideally, I would like to have readers be able to subscribe to one or the other as well as to a combined RSS feed that contains the entries from both combined.

@Guts
Copy link
Owner

Guts commented Dec 16, 2023

Thanks for the quick completion. It sounds like an interesting feature and fits the RSS expected behavior.

Is that an addition on the plugin's side or the template side?
Or can you point me where in a plugin's code this multiple instances support is implemented please?

@Guts
Copy link
Owner

Guts commented Dec 16, 2023

Just found out the PR in Mkdocs that added this possibility: mkdocs/mkdocs#3027

And here in the blog plugin: https://github.com/squidfunk/mkdocs-material/blob/master/src/plugins/blog/plugin.py#L57

Maybe it's just about this line?

@alexvoss
Copy link
Contributor Author

I am not entirely sure what is required from a technical side, apart from declaring that the plugin supports multiple instances. As far as I can see (from this search), supports_multiple_instances merely turns off the warning message that a plugin has been added twice.

It could be that nothing more needs to be done - except there would need to be a way to specify the paths where the different RSS feeds should be mounted. Without that the two instances overwrite each other's output. Here is a minimal example: multiblogrss.zip

@Guts
Copy link
Owner

Guts commented Dec 17, 2023

Allowing to set the feeds output in options is on the path.

You should also consider this ongoing work #185

@alexvoss
Copy link
Contributor Author

The two cases are different, I think, because with the categories you would want to be able to just create a new one and have another feed. You would not want to have to configure multiple instances for this.

If you wanted to have feeds for different blogs this way you would need to ask people to turn on category feeds and assign categories to the blog entries. With the meta plugin in Insiders that would be doable but perhaps people do not want to turn on category feeds because that might multiply the number of feeds generated - by the number of categories, which may be significantly bigger than the number of blogs.

The multiple instances also allow settings that are specific to the different blogs, which makes sense. I still think that the multiple instances are the solution here. The combination with the category channels means that the paths for multiple instances would need to act as base paths for the category feeds. I would suggest letting the existing PR run its course and then looking at the impact of defining base paths for the feed of an instance. There is no particular urgency here as long as we are not talking months.

Hope this helps.

@alexvoss
Copy link
Contributor Author

I note that you have assigned this to me. Is that a way of saying that you would like a PR on this when the time is ripe?

@Guts
Copy link
Owner

Guts commented Dec 17, 2023

I note that you have assigned this to me. Is that a way of saying that you would like a PR on this when the time is ripe?

Not at all! It's to say that this issue is waiting an action from this person. For now, it's mostly meaning: "I've answered, It's up to you to talk"

@Ralvine
Copy link

Ralvine commented Apr 22, 2024

I note that you have assigned this to me. Is that a way of saying that you would like a PR on this when the time is ripe?

Not at all! It's to say that this issue is waiting an action from this person. For now, it's mostly meaning: "I've answered, It's up to you to talk"

hello, I have the same issue. I hope to construct multiple RSS subscription links on my mkdocs website (that is, I hope this plug-in can support generating multiple sets of RSS subscription XML files, and each file can be configured with different regular expression rules to filter different articles) , to realize that articles of different categories on the website can be subscribed separately. I think this can be achieved through different regular expressions, but currently the plug-in only supports a unique configuration, which is a pity.

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