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

[FEATURE] Support vanilla mkdocs #52

Closed
redtide opened this issue Jun 2, 2023 · 14 comments
Closed

[FEATURE] Support vanilla mkdocs #52

redtide opened this issue Jun 2, 2023 · 14 comments

Comments

@redtide
Copy link

redtide commented Jun 2, 2023

Plugin version

v2.2.5

Is your feature request related to a problem? (optional)

I'm not using mkdocs-material because it doesn't fulfill my requirements, so I did my own theme.
Your plugin seems to work, except for the size setting.
If I leave the default paging, it show all posts (say 12) in one page with 3 clickable pages, which does nothing else than add a blog-pN on the url address.
Disabling the paging it shows the correct number of posts, but without paging can't see the others, like it is working on the opposite way.

What is your suggestion?

IDK if this is a bug or just because it's not running with mkdocs-material, I would like it could work as expected also on mkdocs.

Any other idea?

No response

Additional context (optional)

No response

@liang2kl
Copy link
Owner

liang2kl commented Jun 6, 2023

Here's how the pagination works:

// Togglg visibility of pages
const destPage = parseInt(this.textContent)
var pages = document.getElementsByClassName("page")
if (destPage && pages.length) {
for (var j = 0; j < pages.length; j++) {
const pageId = parseInt(pages[j].id.replace("page", ""))
if (pageId != destPage) {
// This is not the destination page
if (!pages[j].className.includes("blog-hidden")) {
pages[j].className += " blog-hidden"
}
} else {
// This is the destination page
pages[j].className = pages[j].className.replace(" blog-hidden", "")
}
}
scrollToTop();

Each time you press the paginator, the elements for "current page" remove their blog-hidden class, while the others add it. Is this providing you with any clues?

@redtide
Copy link
Author

redtide commented Jun 6, 2023

I'm saying that if I have 12 posts and I set size: 5 the paging is correct (3 pages) but it shows all items in each page, not just 5.

@liang2kl
Copy link
Owner

liang2kl commented Jun 6, 2023

but it shows all items in each page, not just 5.

The code above shows exactly how these pages posts get displayed or hidden, by changing their classes.

@redtide
Copy link
Author

redtide commented Jun 6, 2023

IDK what your code does nor I have to look or touch it, I'm here to report an issue I have by using your plugin.
I only have 12 post files and a configuration file where I set the count of posts it should list on each page that plugin does not respect, except for the pagination below, that's all.

@liang2kl
Copy link
Owner

liang2kl commented Jun 6, 2023

I am showing you this code because you have used your own theme, which might have significantly different css styles that might conflict with my implementation. So I am actually providing you with the possible conflicting stuff from my code. If I can't have more context, I am afraid that I cannot fix it.

@liang2kl
Copy link
Owner

liang2kl commented Jun 6, 2023

IDK what your code does nor I have to look or touch it

Again, the display of the posts is NOT COMPLETELY CONTROLLED BY THE PLUGIN CODE, it might also be affected by the css classes and styles.

@liang2kl
Copy link
Owner

liang2kl commented Jun 6, 2023

There's actually a problem with the post display but in a different way. The paging won't work on the first page but is fine on others regardless of the page settings.

Thanks for spotting the problem and sorry for my previous responses. I originally thought it was a problem caused by your theme because of your description, but it turns out it's a universal bug. I will drop a release soon.

liang2kl added a commit that referenced this issue Jun 6, 2023
@liang2kl liang2kl closed this as completed Jun 6, 2023
@redtide
Copy link
Author

redtide commented Jun 6, 2023

There's actually a problem with the post display but in a different way. The paging won't work on the first page but is fine on others regardless of the page settings.

here each one of 3 pages show all 12 posts

Thanks for spotting the problem and sorry for my previous responses. I originally thought it was a problem caused by your theme because of your description, but it turns out it's a universal bug. I will drop a release soon.

no problem. I'm not using "blog-hidden" css class.

@redtide
Copy link
Author

redtide commented Jun 6, 2023

just tried the new release and nothing changed here, same issue in all pages.
Note that I haven't opened it as a bug but as a feature request to make it work also on non material theme, so this should be reopened (and I can't because you closed it).

@liang2kl
Copy link
Owner

liang2kl commented Jun 6, 2023

Could you please upload an example to reproduce the issue?

@liang2kl liang2kl reopened this Jun 6, 2023
@redtide
Copy link
Author

redtide commented Jun 6, 2023

sure, give me some time to setup a temporary github repository, I'll let you know when done

@redtide
Copy link
Author

redtide commented Jun 6, 2023

here the code: https://github.com/redtide/mkdocs-test
the site link is on the about section.
The only related things are in mkdocs.yml, the docs/news directory and the link in the navbar.

liang2kl added a commit that referenced this issue Jun 8, 2023
Add `md-typeset` wrapper on blog posts to support other themes
@liang2kl
Copy link
Owner

liang2kl commented Jun 8, 2023

Here's the problem:

The plugin is adapted for mkdocs-material, which wraps all customizable elements with the md-typeset class. My plugin adopts this design and only sets the styles under md-typeset, and thus the styles do not apply to your theme.

The latest commit solves this issue.

@redtide
Copy link
Author

redtide commented Jun 8, 2023

Thank you very much! You were right about the CSS in the end, just the culprit was hidden somewhere else. It's nice to have it working without the material theme dependency, so now another thing solved for me to port my Jekyll projects to MKDocs.

@redtide redtide closed this as completed Jun 8, 2023
liang2kl added a commit that referenced this issue Jun 8, 2023
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

No branches or pull requests

2 participants