Blogdown & Hugo

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

  • 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!

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?

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?

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

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

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?

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

Thanks...live and learn!

Yes!

https://twitter.com/apreshill/status/1078494406301212672

1 Like

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)

1 Like

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

2 Likes

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!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.