rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.73k stars 335 forks source link

Problem with site appearance when deploying via Netlify #114

Closed jrosen48 closed 7 years ago

jrosen48 commented 7 years ago

Thanks for a great package.

When I use blogdown::serve_site(), the site displays correctly:

screen shot 2017-05-29 at 8 02 48 am

However, when I deploy the site to Netlify (with build command hugo and publish directory public), the site does not appear to appear to display correctly:

screen shot 2017-05-29 at 8 04 25 am

In particular, all of the theming seems to not be appearing.

Are there changes I can make to the site's files or other changes I can make the appearance on Netlify as it displays locally?

znmeb commented 7 years ago

Your problem may be using "hugo" to build rather than Blogdown / RStudio. Here's my process, which is known to work (on Linux - may need adjustments on Windows but should work on a Mac):

  1. In RStudio, set up the "Build" tools. Then do a "clean" and a "build".
  2. Open a terminal. "cd" into "public" and type "netlify deploy".

You'll get a menu ... use the arrow key to select the site you want (or create a new one). Then when it finishes, browse to the site.

cderv commented 7 years ago

I had the same problem and moreover with the same theme. You have to get your configuration right in config.toml by setting baseurl to your netlify url. Otherwise, component of your theme (css, js, ...) is not found.

See blogdown documention about configurations

yihui commented 7 years ago

My guess would be the same as @cderv. It will be much easier to debug the issue if the source is on Github or at least show us a link to your website @jrosen48.

jrosen48 commented 7 years ago

It seems to be deploying fine when I follow the first choice for deploying blogdown via GitHub Pages: "The first choice is to follow the default structure of a Hugo website like the diagram below, and initialize the GIT repository under the public/ directory:" So, it seems to be finding the theme components even though the config file doesn't have baseurl set.

The repo with the public directory is here: https://github.com/jrosen48/jrosen48.github.io

The source files for it are here.

The site on Netlify is here: https://maid-hilda-58016.netlify.com/

So, it seems to be working when I use the public directory (i.e., following the first choice described for deploying blogdown via Github). I haven't confirmed that changing the baseurl would fix this, as well.

yihui commented 7 years ago

Since we no longer have access to the broken page, I have no idea how to debug it.

You set baseurl to / and that should be okay. Although you had problems with Netlify, I still recommend to use Netlify instead of Github pages: https://yihui.name/en/2017/06/netlify-instead-of-github-pages/

Note you can (and should!) change the name maid-hilda-58016 on Netlify. If you are willing to join rbind (https://support.rbind.io/about/), I can offer you a *.rbind.io subdomain.

jrosen48 commented 7 years ago

Thanks for your support. Sorry I made a different change before figuring out if what you and the others helpfully recommended. I joined the rbind community and think I may like rbind.io more than github.io URL (and certainly better than maid-hilda....

maurolepore commented 6 years ago

I had the same problem and fixed it as @cderv and @yihui suggested: I fixed the baseurl which didn't exactly match the site name on netlify.

Thanks all.

djanesh commented 6 years ago

Same here. Fixing baseurl fixed issue.

flh3 commented 6 years ago

Hello -- thanks for working on this great package. I am working with blogdown, Github, and Netlify. The way the three of those work together is amazing.

My website deploys properly (i.e., base URL is fine, links work, updates work) but then there are some small items that are not the same (e.g., font size). I am using the academic theme.

I am trying to figure out what is the cause of that. I noticed that when using the serve_site() function, the following is displayed:

> 
>                    | EN  
> +------------------+----+
>   Pages            | 77  
>   Paginator pages  |  1  
>   Non-page files   |  1  
>   Static files     | 18  
>   Processed images |  0  
>   Aliases          | 20  
>   Sitemaps         |  1  

On Netlify-- I tried redeploying the site and it indicates this:

7:26:48 PM:                    | EN
7:26:48 PM: +------------------+----+
7:26:48 PM:   Pages            | 72
7:26:48 PM:   Paginator pages  |  1
7:26:48 PM:   Non-page files   |  1
7:26:48 PM:   Static files     | 18
7:26:48 PM:   Processed images |  0
7:26:48 PM:   Aliases          | 18
7:26:48 PM:   Sitemaps         |  1
7:26:48 PM:   Cleaned          |  0

I was hoping a clean redeployment would fix things. However, the number of pages is different from what serve_site() is reporting and what Netlify is reporting. (77 vs 72)-- what might be causing that?

Thank you in advance.

cderv commented 6 years ago

the number of pages is different from what serve_site() is reporting and what Netlify is reporting. (77 vs 72) ?

Do you have draft pages ? (with draft: true in yaml). serve_site rendered everything including draft page and build_site does not. It could be the cause of the difference you observed.

One remark on your question: An old closed issue in Github is not the better place to ask such question. All the more if your issue is not related to the topic of the github issue. (And here, it is not related). I think you should search for help on this kind of topic on Q&A site like https://rstudio.community.com or http://stackoverflow.com/. There will be a broader audience and it won't overcharge the github issue board preferred for bug issue or feature request issue. Thanks!

pupaglupa commented 6 years ago

I'm having the exact same problem but with a different theme (hugo-theme-sam). I've tried many different variants of the url in the baseurl section of the config.toml file but nothing seems to work... any other ideas?

pat-s commented 6 years ago

@pupaglupa Do you have a slash at the end of the baseURL by chance? (its needed) This problem costed me hours...

tcgriffith commented 6 years ago

@pupaglupa could you show us your repo?

Dylan-Padilla commented 4 years ago

Hi everyone,

I have the same problem as @jrosen48... My baseurl in my config.toml is correct. Once I run blogdown::serve_site(), my website works well. However, when I try to update it from Netlify, I cannot see the changes I have done. This is the link for my repository https://github.com/Dylan-Padilla/website and this is the link for my website https://dylanpadilla.netlify.com/

Can you guys help me with this please? I appreciate the attention!

dorinstanciu commented 4 years ago

@pupaglupa Do you have a slash at the end of the baseURL by chance? (its needed) This problem costed me hours...

@pat-s Man... I know it's a no no to just write thank you.... but i couldn't help myself. I've been rewriting everything for hours, actually days... I was just about to give up and fall back on GitHub Pages... :) God bless your account :)

jacksanford1 commented 4 years ago

Thank you @cderv! I couldn't figure out why my site looked different locally vs. on netlify and I didn't realize some pages had "draft" statuses. Saved me a lot of time!

trashbirdecology commented 4 years ago

holy shit @cderv you just saved me what i suspect would be about 3 hours THANK YOU

jschulberg commented 3 years ago

Looks like I'm having the same issues as those above me! The issue arose when I tried converting all of my posts to the new bundle format. If anyone could help me figure what in tarnation is going on, I would be much appreciative!

GitHub: https://github.com/jschulberg/DatacracyBlog Site: https://datacracy.netlify.app/

cderv commented 3 years ago

Hi @jschulberg,

I am not sure this is the same issue. It is always better to open a new one and link to a similar one. Can you open a new one to discuss this specific issue with your site in its own thread ? Thank you.

jschulberg commented 3 years ago

@cderv sure thing

yihui commented 3 years ago

To anyone still coming to this issue, please run blogdown::check_site() and it should uncover most common problems for you (such as draft posts). Please open a new issue if it doesn't solve your problem.

benyizhang commented 3 years ago

I had the same problem and moreover with the same theme. You have to get your configuration right in config.toml by setting baseurl to your netlify url. Otherwise, component of your theme (css, js, ...) is not found.

See blogdown documention about configurations

Hi I have done exactly same step as you suggested. However, it did not fix the problem at all.

cderv commented 3 years ago

Did you ran blogdown::check_site() ? Is everything ok - no todos ?

benyizhang commented 3 years ago

g Hi Thanks for your kind suggestions :). The issue is now being resolved.

Here is what I did:

I ran blogdown::check_site() and it suggests me to open the config.yaml and change baseURL setting for hugo. So I just redirect the baseURL to my site with the forward slash, and Netlify shows my site perfectly. However, I still don't understand why we should go for config.yaml, instead of the config.toml

Thank you for your suggesiton :) .

cderv commented 3 years ago

I ran blogdown : : check_site( ) and it suggests me to open the config.yaml and change baseURL setting for hugo. So I just redirect the baseURL to my site with the forward slash, and Netlify shows my site perfectly.

That is great !

However, I still don't understand why we should go for config.yaml, instead of the config.toml

You can you both format, but only one or the other per site. And check_site() should give you advice according to the one you have in your project. blogdown will default to YAML config file when you create a new site, unless you say otherwise with blogdown::new_site(format = "toml").

ocstringham commented 3 years ago

For those who still can't get it to work, try to disable CSS optimization in Netlify. Under Site Settings --> Asset Optimization uncheck “Bundle CSS” and “Minify CSS”. After I redeployed the site, my CSS loaded correctly.

cderv commented 1 year ago

@nicholaskemery Please do open new issues or ask on Q&A website like community.rstudio.com or Stackoverflow. This issue is 6 years old.

Same answer as https://github.com/rstudio/blogdown/issues/114#issuecomment-790631317

Did you ran blogdown::check_site() ? Is everything ok - no todos ?

Also I don't see any issue in your website : https://nicholaskemery-personal.netlify.app/ What is exactly not showing ?