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

homepage limited to 5 articles #403

Closed
lgnbhl opened this issue Sep 17, 2021 · 13 comments
Closed

homepage limited to 5 articles #403

lgnbhl opened this issue Sep 17, 2021 · 13 comments
Labels
bug 🐛 Something isn't working

Comments

@lgnbhl
Copy link

lgnbhl commented Sep 17, 2021

Hello,
After updating the distill R package to the most recent version, the homepage (index.html) of my blog is blank. However, reducing the number of articles in the _posts makes the page rendering correctly.

When I remove visibility: hidden; inside index.html, I have the same issue reported here: https://community.rstudio.com/t/distill-website-deployment-on-rstudio-connect-does-not-render-linked-articles/88900/6.

Any idea how to fix that?

Thanks a lot!

@lgnbhl
Copy link
Author

lgnbhl commented Sep 18, 2021

A quick fix would be to manually change var max_posts = 25; to var max_posts = 6; inside index.html. It would be great to be able to add this variable in the _site.yml. If this modification fixes the CSS issue shared above, the thumbnails are still not rendering in the index.html homepage :(

function set_posts_visible(posts, visible) {
    if (visible) {

      // show bottom border by default
      $(posts).removeClass('post-preview-last');

      // apply limits if need be
      var max_posts = 25;
      var apply_limits = $('.posts-container').hasClass('posts-apply-limit');
      if (apply_limits && posts.length > max_posts) {
        posts = $(posts).slice(0, max_posts);
      } else {
        $('.posts-more a').addClass('hidden');
      }

@jhelvy
Copy link

jhelvy commented Sep 21, 2021

After much trial and error, I discovered the same problem on the Distillery site. I could not for the life of me figure out what was going on until I removed the posts one at a time to find the magic number 5 worked. This must be a bug in a more recent version of {distill} because this didn't previously happen.

@lgnbhl
Copy link
Author

lgnbhl commented Sep 21, 2021

Thank you for sharing @jhelvy.
Note that with my quick fix shared above (change 'var max_posts = 25;' to 'var max_posts = 6;' in the 'index.html'), all the articles are accessible after clicking on "More articles »" in the bottom left of the homepage (at the exception of the thumbnails that are not rendering)

@jhelvy
Copy link

jhelvy commented Sep 21, 2021

I'll do this. But this should be controllable in the site yml . There's an option to set the max number of feed times to display, e.g.

collections:
  posts:
    categories: true
    categories_metadata: true
    feed_items_max: 20

Perhaps this is being ignored?

@cderv cderv added the bug 🐛 Something isn't working label Sep 24, 2021
@caayala
Copy link

caayala commented Sep 29, 2021

Thanks for your work around @lgnbhl.
I had the same issue in our blog: https://blog.desuc.cl

@p0bs
Copy link

p0bs commented Sep 30, 2021

Same issue here, too. I have a suspicion that this will be true for anyone who uses distill and updates their site

@cderv
Copy link
Collaborator

cderv commented Sep 30, 2021

Hi everyone,

sorry for the trouble with this issue. It took me a bit of time to find the source of the issue.

This issue is caused by last rmarkdown release 2.11 which upgraded default JQuery to version 3. It seems there is a conflict with distill JS library that needs to be fixed. I am onto it.

I believe you all are using rmarkdown 2.11, right ?

With this version, as a workaround waiting for a fix, you can set back the use of JQuery 2 using

options(rmarkdown.jquery.version = 2)
  • either before rendering, e.g

    withr::with_options(
      list(rmarkdown.jquery.version = 2), 
      rmarkdown::render_site(".")
    )
  • either inside .Rprofile for the project (for example using usethis::edit_r_profile("project"))

These are temporary workaround, and we'll push a fix in the package very soon.

Thanks for your patience.

@cderv cderv closed this as completed in 0e374d6 Sep 30, 2021
@cderv
Copy link
Collaborator

cderv commented Sep 30, 2021

The issue should now be fixed: I don't get a blank homepage anymore.

No need to do anything on your project except upgrading to last dev version of the package.

remotes::install_github("rstudio/distill")

If this does not fix the issue, or it was not the only thing happening for you @lgnbhl I'll reopen an have another look.

Same for you @caayala, @jhelvy, and @p0bs - maybe this was not the only cause of the issue.

Thanks

@lgnbhl
Copy link
Author

lgnbhl commented Sep 30, 2021

Hi @cderv ,
Thanks a lot for this quick fix! It is working for me now 👍 .
I am wondering if it is possible to add a max_posts variable in the _site.yml? Does this functionnality already exist? Do you want me to create a new issue to ask for this feature?
Best,
Felix

@cderv
Copy link
Collaborator

cderv commented Sep 30, 2021

I am wondering if it is possible to add a max_posts variable in the _site.yml? Does this functionnality already exist? Do you want me to create a new issue to ask for this feature?

I need to look into this. Can you open a new issue so that we discuss and track this idea ? Thanks!

@caayala
Copy link

caayala commented Sep 30, 2021

it's working again. Thanks!

@jhelvy
Copy link

jhelvy commented Sep 30, 2021

Yup, the distillery tips & tricks page is also back up - thanks for the quick fix @cderv!

@cderv
Copy link
Collaborator

cderv commented Sep 30, 2021

Thanks all. I think we can consider the issue fixed then.

Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants