Closed yihui closed 7 years ago
Thanks! I am traveling this whole week but I will get back to this over the weekend. And thanks much for your support.
Sounds good. It is a simple change but you may need some time to think about the consequences. I have tested both blogdown and other R Markdown documents, and they seem to still work well.
Yeah it's mostly to test out every possible R Markdown format.
I am testing this now, and so far works with rmarkdown, rmarkdown-website, xaringan, flexdashboard. But I still require the hackish way of using a Makefile and specifying widgets_dir for bookdown. Otherwise the dependencies are not moved to the final book output directory. Tomorrow I'll check for the blogdown part.
I'll address the bookdown issue in bookdown when I have more time. You won't need any changes in widgetframe.
I just tested this with blogdown and it works perfectly if the method is 'html', but doesn't work if the method is html_encoded
. The widgets folder is neither to be found under static
folder and hence also not present under the public
folder.
I am fine documenting this limitation, but it would be awesome if we can support html_encoded
too.
You are correct. It does not work with html_encoded
. I don't think there will be more than three people in the world who would use html_encoded
. The benefit is minimal, and the disadvantages sound bad enough.
@yihui Thanks for the fix. One more small point the URL to the iframed widget HTML works only when the site is deployed on the root. When the site is deployed in a level below the root, i.e. http://www.abcd.com/blog/, then the URL to the child widget HTMLs is wrong. This is not a big issue as I really doubt if many people will deploy their blogs to non root path.
Thanks again for your help!
I'm still getting an error in my file, and I think it has something to do with @bhaskarvk most recent comment.
I'm trying to use a widgetframe with datatable in a .Rmarkdown that lies within my /pages subdirectory. The frame just pulls up my 404 page. I'm also running on the future-imperfect theme, which I know has had some trouble in the past.
Any solutions?
It should work unless you have set relativesurl = true
in config.toml. Try to remove this option or set it to false
, then blogdown::build_site()
with the latest version of blogdown.
@elliottmorris could you share your config files and where you deploy your site?
I tried setting relativesurl = false
and updating both blogdown
and widgetframe
to their latest versions, but still to no avail.
Attempting to display the widget at http://www.thecrosstab.com/trump-tracker/. Attached is my config.toml in text format. config_toml.txt
EDIT: there seems to have been a corrupted download for blogdown. Have reinstalled, restarted, rebuilt and it all works now. Thanks for the tip on relativesurl.
Okay, glad to hear that.
FWIW I don't think relativeurl
was your problem to begin with. It must have been sometihng to do with corrupt blogdown install. @yihui I double checked and regardless of what relativeurl is set to the url attribute for the iframe source starts with an absolute path. so something like '/post/....' which works fine when the site is deployed at the root of a webserver which is what @elliottmorris is doing.
But if the site is deployed one level down so e.g. www.abcd.com/blog/
instead of www.abcd.com
then it won't work coz the URL is not changed to /blog/post as it should be.
@bhaskarvk When relativeurls = false
, you should get /blog/post/...
instead of /post/...
. Could you test with the latest version of blogdown?
I actually don't have a /blog/ folder and set permalink to match Jekyll structure (:year/:month/:day/:slug) so this doesn't show up either way
On Aug 9, 2017, at 12:51 AM, Yihui Xie notifications@github.com wrote:
@bhaskarvk When relativeurls = false, you should get /blog/post/... instead of /post/.... Could you test with the latest version of blogdown?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
FWIW I don't think
relativeurl
was your problem to begin with. It must have been sometihng to do with corrupt blogdown install. @yihui I double checked and regardless of what relativeurl is set to the url attribute for the iframe source starts with an absolute path. so something like '/post/....' which works fine when the site is deployed at the root of a webserver which is what @elliottmorris is doing. But if the site is deployed one level down so e.g.www.abcd.com/blog/
instead ofwww.abcd.com
then it won't work coz the URL is not changed to /blog/post as it should be.
I am suffering from the same behavior. But I am using "hugo-creative-portfolio-theme". Basically, I am deploying one level down www.abcd.com/website instead of www.abcd.com and the URL inside the widgetframe is pointing to the www.abcd.com. Any solution?
IIRC, you should specify the subdirectory in the baseURL
field of your config.toml
, IE:
baseURL: abcd.com/website/
This is covered more extensively in @yihui’s blowdown book: https://bookdown.org/yihui/blogdown/configuration.html
This will fix rstudio/blogdown#38.