arnold-c
arnold-c

Reputation: 357

Is there a way to embed a bookdown document as a blogdown post?

I have created a tutorial using Bookdown (which I think is a great format for it), and am currently in the process of creating a website using Blogdown (hugo-academic theme). I would like to be able to add this tutorial to a tutorials page as a Bookdown post, but I don't know if that's possible.

I'm new to Blogdown, so I haven't been able to find any solutions to this. If it's not possible, is there a way of changing the post link to a hyperlink that takes the user to a published Bookdown file (perhaps to bookdown.org)?

Upvotes: 3

Views: 246

Answers (1)

Ralf Stubner
Ralf Stubner

Reputation: 26823

From my point of view it makes more sense to keep the tutorials (written with bookdown) separate from the rest of the website (written with blogdown). One possible solution is to use the "portfolio" widget together with content that uses external_link, similar to how "external projects" work. Since you do not want the tutorials widget on the home page, you need to do the following:

  1. Create a directory content/tutorial containing directories for every individual tutorial. Each of these directories contains an index.md modeled after "external project", i.e. with an external_link attribute.

  2. Create a second directory content/tutorials with an index.md widget page, c.f. https://sourcethemes.com/academic/docs/managing-content/#create-a-widget-page

  3. Create in the second directory a portfolio widget, e.g. by copying projects.md, where you set page_type to tutorial (the name of the first directory).

The crucial point is that you need two directories. One for the tutorials and one for the widgets. Full example is on GitHub. Of course, it would make sense to add a link to /tutorials/ (not /tutorial/!) to your sites menu.

Upvotes: 3

Related Questions