Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates/content-home.html is ignored if source is .Rmd #787

Closed
goldingn opened this issue Aug 24, 2018 · 3 comments
Closed

templates/content-home.html is ignored if source is .Rmd #787

goldingn opened this issue Aug 24, 2018 · 3 comments
Labels
feature a feature request or enhancement home 🏠

Comments

@goldingn
Copy link
Contributor

When building the home page, the template content-home.html is only respected if the source is a .md or DESCRIPTION file. If it's index.Rmd or README.Rmd, the template content-article.html is used instead.

That caught me out whilst building a custom site with my own templates, and means the sidebar can't be removed from the home page without also removing it from all the articles.

The switch happens here:
https://github.com/r-lib/pkgdown/blob/master/R/build-home-index.R#L14-L26
and the call stack for .Rmd sources goes: render_index() > build_rmarkdown_format() > rmarkdown_template() > render_page(pkg, "article", data)

I've pushed a branch on my fork here with one passing test (for index.md) and one failing test (for index.Rmd) to demonstrate.

Let me know if you'd like that in a PR. Unfortunately I won't have time in the near future to send a fix.

@goldingn
Copy link
Contributor Author

goldingn commented Oct 7, 2018

I've rebased that branch with the failing test onto the current master: https://github.com/goldingn/pkgdown/tree/rmd_home_template

I might be able to take a swing at getting home templates to work for Rmds this week.

I'd appreciate any pointers though. Especially why md and Rmd are treated so differently, rather than converting Rmd to md first.

@jayhesselberth
Copy link
Collaborator

I'm not sure what you're trying to do. Do you want to be able to render a Rmd file into a home page that does not have a sidebar? If so you could also use custom JS/CSS to hide the sidebar on the home page.

@goldingn
Copy link
Contributor Author

goldingn commented Oct 7, 2018

The general issue is that a custom content-home template is ignored if the source file is an Rmd (but not if it is an md), which isn't documented and seems like a bug.

My main aim is to get rid of the sidebar and the column it goes in, and take the index content out of the the row and column it's in, since I want a full width banner.

I could do this if I could use a custom template of:

{{{index}}} 

Those rows and columns are hard-coded into the content-home template:
https://github.com/r-lib/pkgdown/blob/master/inst/templates/content-home.html

How would I turn them off with css?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement home 🏠
Projects
None yet
Development

No branches or pull requests

3 participants