rstudio / blogdown

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

Why my image does not appear in the site but does in my ::serve? #472

Closed gustavo-etal closed 4 years ago

gustavo-etal commented 4 years ago

By filing an issue to this repo, I promise that

gustavo-etal commented 4 years ago

image

widget = "blank" # See https://sourcethemes.com/academic/docs/page-builder/ headless = true # This file represents a page section. active = true # Activate this widget? true/false weight = 5 # Order that this section will appear.

title = "The Machado research group" subtitle = "Disease spread and modeling"

[design]

Choose how many columns the section has. Valid values: 1 or 2.

columns = "1"

[design.background]

Apply a background color, gradient, or image.

Uncomment (by removing #) an option to apply it.

Choose a light or dark text color by setting text_color_light.

Any HTML color name or Hex value is valid.

Background color.

color = "red"

Background gradient.

gradient_start = "lightred"

gradient_end = "SkyBlue"

image = "simulation.jpg" # Name of image in static/img/. image_darken = 0.5 # Darken the image? Range 0-1 where 0 is transparent and 1 is opaque. image_size = "cover" # Options are cover (default), contain, or actual size. image_position = "center" # Options include left, center (default), or right. image_parallax = true # Use a fun parallax-like fixed background effect? true/false

image

cderv commented 4 years ago

Hi, Can you provide a reproducible example of this ? You checked the box in the issue template, but this is not really reproducible.

From what I know, with Hugo site when you server it with serve_site(), it will use a web server in R to preview your site. You can't just open the index.html in the browser, your file may not load correctly. You need to use a web server to host the website. Preview in the RStudio IDE won't work well without this.

Also, some adjustements are made regarding base url on your site when using this function. Usually you need to set a base_url (see https://bookdown.org/yihui/blogdown/configuration.html#options) and sometimes you can also set relativesURL to true also.

In any case, see the recommandation of RStudio configurations here: https://bookdown.org/yihui/blogdown/rstudio-ide.html The footnote 14 mentions it is required when relativeurls options in not set.

gustavo-etal commented 4 years ago

Thank you, I made it public here https://github.com/gustavo-etal/Machado_lab_ted

I am using a google domain + https://app.netlify.com/sites/machadolab/overview to deploy

Name of Academic theme folder in themes/.

theme = "hugo-academic"

baseURL = "https://gustavo-etal.github.io" publishDir = "public"

thank you

gustavo-etal commented 4 years ago

Done! your relativeurls= true worked than you have a lovely day

cderv commented 4 years ago

Glad it works! Don't forget to check the meaning of this option so that you don't have any suprises though https://gohugo.io/content-management/urls/#relative-urls