Blogdown & Hugo

blogdown

#1

I am new to using blogdown. I cannot get the html to render what I changed in the index.html. In fact, I make a change save it, then refresh the browswer to ensure it looks like what I want but no changes take affect. The index.html file reverted back to what the original theme example was. I tried this on two themse; the hugo-academic and the silhouette-hugo (preferred) themes.

I also have not been successful in seeing images from the example or trying to upload my images for the main site (haven't tried yet in the blog sections).

Changes made to the config.toml file have saved and seem to work correctly.

Window 10
R Version 3.5.1
RStudio Version 1.1.463
Hugo version 0.53
Blogdown version 0.10


#2
  • Where is your index.html saved? Make sure it is saved and named properly. Take a look here for hugo specific tips: https://www.youtube.com/watch?v=ut1xtRZ1QOA
  • Your changes to index.html should not depend on theme: hugo is supposed to to overwrite theme templates with your index.html. I feel like you're either looking past the homepage, or saving or naming the file wrong.
  • Can you make radical changes to your index.html to rule out any changes not taking effect due to improper html code? E.g. Can your index.html say "Hello world" and that's it, nothing else, no code?
  • A more descriptive topic title and more details on the problem would be helpful in the future... Thank you!

#3

Thanks for the video link. I will certainly watch it. I have not changed the file names at all. I can change the index. html file to show "hello world" but again after I refresh my browser the index.html file keeps reverting back to the original code as downloaded from the template examples.

I am editing the index.html in the RStudio window. Should I open the file to edit from Windows instead?


#4

I am confused...

  • Browser refresh shouldn't override any files. Browser refresh won't do anything to your site.
  • Are you saying index.html literally gets overwritten with default code? Like, the actual contents of the file change from the last saved?
  • Which index.html is it?
    • your-site/layouts/index.html or
    • your-site/themes/your-theme/layouts/index.html?

#5

That is exactly what I am saying. I am changing the public/index.html


#6

Hi,

It sounds like you may benefit from starting from scratch- https://bookdown.org/yihui/blogdown/a-quick-example.html.

With blogdown, you should not be editing any .html files in the public/ folder. Those are rendered automatically every time you serve your site. To make changes to what you see as the landing page (index.html), you should be making changes to files in the content/ folder. I think you'll experience less frustration taking a step back and reading the documentation a bit further: https://bookdown.org/yihui/blogdown/hugo.html

Alison


#7

Ok, so that is something I was thinking about but couldn't find documentation on that even following the blogdown book. Are changes to subsequent pages to be changed in the content folder as well?


#8

Alright, we have a winner. Don't touch the public folder, and you'll be just fine.
public is for hugo, not for you.


#9

Thanks...live and learn!


#10

Yes!


#11

Well...

The publishing directory (by default, public/ ). Your website will be generated to this directory, meaning that you do not need to manually add any files to this directory.

(from the book)


#12

Note that this quote is in the "quick example" I linked to above- it is a great 3-5 minute quickstart guide!


#13

Indeed, "quickstart" is a great start, but the manual as a whole is a great guide: it answers most of the questions one can have while building their first blogdown site.
When it comes to troubleshooting, nothing beats reading the documentation!