rstudio / blogdown

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

How to use the "Get started!" Button to download my Curriculum #300

Closed athammad closed 6 years ago

athammad commented 6 years ago

Hi,

I'm using thehugo-creative-theme and I would like to use the "Get started!" Button in the About section as a download button to my cv.pdf located in /public/img.

Since I couldn't find any clear way to do it in the config.toml file I have tried to change theindex.html file replacing

<a href="#" class="btn btn-default btn-xl">Download CV</a> with <a href="img/AHMED_T_HAMMAD_Cv.pdf">Download CV</a>

but somehow when I try to render the file nothing changes.

Any idea? cheers

cderv commented 6 years ago

I don't think this is a blogdown issue. It is just that the hugo theme you use do not allow by default to modify the link behind button. See the partial file on about.html https://github.com/digitalcraftsman/hugo-creative-theme/blob/cea31c1813c13e76764c84417de3578b2ad876ed/layouts/partials/about.html#L15 You can see that only the button text is as a Params to put in config.toml

I think it is possible and not so difficult to modify the theme to add an option to configure the url in config.toml as it is for button text.

About the rendering part, which index.html did you change ? the one in the theme folder or the one in site folder that is render by hugo ?

As I don't think this is a blogdown issue, you should post your question for ideas on https://community.rstudio.com An awesome community will be able to help you there!

athammad commented 6 years ago

Cderv, thank you for your quick replay. Sorry but I'm very new in blogdown and I don't know how to program with Hugo.

Are you saying that by modifying the about.html I can achieve what I want?

I've tried to change both the index.html but with no result.

cderv commented 6 years ago

Blogdown is a great to tool to create a blog with Hugo and it brings Rmarkdown to Hugo.
All the website part is generated trough Hugo. It renders all markdown file to html and uses a hugo template to generate the website.
A hugo template is a folder with some files, mainly html that are templates to be rendered using all the yaml header and configuration from config file. A template has built in feature and a few options for customization. It is a hugo mechanism, not a blogdown mechanism. At the end, this a website (HTML, CSS, JS, ...). Hugo helps you built a great static website without building HTML, CSS and JS from scratch.

You have found a template that suits you: great! However, if the template do not provide with all the feature you want, you need to change the hugo theme, or modify it. You need to dig a bit deeper in Hugo mechanism.

I believe that by tweaking about.html you could achieve what you want, even by adding a new option in config.toml. Otherwise, you can tweak the rendered website by hugo but I think it will be overidde each time you re-rerendered.

I strongly advice you read about [blogdown][https://bookdown.org/yihui/blogdown/) and even Hugo documentations to understand how this works and how you can tweak the them for your need.

For such questions, you should find help on QA sites, using blogdown or hugo tags

There will be a broader audience and more success to get a custom help than here in Github Issue.

athammad commented 6 years ago

Thank you again!!!