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

怎甘沉沦 提交于 2019-12-24 06:38:10

问题


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)?


回答1:


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.



来源:https://stackoverflow.com/questions/57415416/is-there-a-way-to-embed-a-bookdown-document-as-a-blogdown-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!