Jekyll blog using Rmarkdown - jekyll

I have a Jekyll blog hosted on Github Pages, and I wanted to create some posts using RMarkdown. So far I got a file Test.Rmd
---
output: md_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(fig.path = '../assets/images/')
knitr::render_jekyll()
```
Sin plot
```{r sin_plot}
plot(1:100, sin(1:100))
```
that generates Test.md in the same directory when I click the knit button in RStudio. I would like to:
Generate the .md output in another directory /_posts, so I don't have to move it.
Write the Jekyll YAML header in the .Rmd file, so I don't have to edit it afterwards.
That way, I can simply create the .Rmd in a /source directory, located in the same root as /assets and /_posts, click the knitr button and commit/push the changes to Github.
Thank you in advance
PS: I'd rather avoid using blogdown or changing from Jekyll to Hugo

Run servr::jekyll() in the R console to get the .md file in the /_posts directory and delete the .md file in the same folder as the .Rmd file.

Related

Hugo site, deployed to public/ directory in html, gives weird results

I have a Hugo site with lots of folders and subfolders, containing both _index.md files and many others. It uses the docsy theme.
Running hugo server displays the site correctly in the browser at localhost:1313
When I run hugo or hugo -D to get the same pages as HTML files on the disk, and I get
a set of folders...
... containing only index.html and index.xml files,
but no other files. All the other files are missing.
links look like the raw .md file (example: [VPAT](https://docs.axway.com/bundle/AccessibilityVPATS_allOS_en_HTML5/page/Content/accessibility.htm)
The index.html files are unstyled, unlike the pages generated by the hugo server command.
I don't see how to use the index.xml files.
Here is an example of the files and folders produced by the hugo command:
public/
index.html
index.xml
docs/
index.html
index.xml
admin_intro/
index.html
index.xml
troubleshooting/
index.html
index.xml
...
Here is what the .md file structure looks like
content/
en/
_index.html
search.md
docs/
_index.md
admin_intro/
_index.md
amdin_page_1.md
amdin_page_2.md
amdin_page_3.md
troubleshooting/
_index.md
ts_page_1.md
ts_page_2.md
ts_page_3.md
...
It looks like maybe your postcss process isn't running correctly. I had this problem after upgrading Hugo and Docsy
The postcss process isn't used in the dev mod (hugo server) but it is in production (hugo) so you will unfortunately get different results.
Try running hugo locally with the --debug flag and see if any errors show up.

I can't edit Jekyll index.html

I'm trying to change /_site/about in index.html. When I edit the index.html and start jekyll, index.html back to it's original content.
Sorry for my english.Thank you very much for your help.
You don't edit files inside the /_site directory. When jekyll builds the site, it overwrites any and all files in that directory.
Edit the index.html file in the /about/ directory outside of the /_site/ folder.
Run the command jekyll build to apply these changes to the generated site.
Or use jekyll serve to automatically host the content locally and update the content when a change is made.
There's no need to edit Index.html file as it is generated from the markdown file your provided which as we all know is called index.md, whenever you change that file and run jekyll build it re-generates the index.html file hence if you edit once you would have to do the same again when you change index.md file.
So directly write html / markdown in index.md file in your jekyll directory.
Best,
Daksh

Jekyll Wiping My Directory

I followed the instructions for Jekyll Quickstart. Whenever I make changes in my site's directory, the changes get wiped somehow. For example, I modified some of the code in index.html, only to have it return to Jekyll's default. I also created a subdirectory in _site called 'otherservices' with an index.html. That gets wiped as well. Any idea why this may be happening? I can't really use Jekyll if it keeps wiping.
Jekyll is a static website generator, each time it generates a website it place files in the _site folder.
Any changes you make inside the above folder are lost because it is recreated when executing jekyll build or jekyll serve .
Changes should be made to the rest of the files or folders so they will be processed and locate the resulting files inside _site.
You should not write manually into _site directory, that is Jekyll's output.
If you need an otherservices directory in the output, place it one level above, like this:
_site/
otherservices/
index.html
index.md
Jekyll will copy every file and directory into _site, which is not excluded in the configuration and doesn't start with _ prefix. Files that have front-matter will be processed in addition to copying. So in result Jekyll will generate this structure:
_site/
otherservices/ (copies it)
index.html
index.html (generates it from index.md)
otherservices/
index.html
index.md
It is worth reading the documentation on how to create custom pages.

knitr: Why can't I see good version of .html file after knitting with .Rmd on GitHub?

Rstudio 3.2.4
Windows 10 x64
Coursera: Reproducible Research
I wrote a .Rmd file and created from it a .html file using knitr via the "Knit HTML" button in the editor. When I view the .html file on my machine with RStudio it appears how I want (with all output and figures, etc.), but when I upload the directory to GitHub and view the same .html file, I see only HTML code. I expect to see the nice file I saw in RStudio.
I pushed the entire directory containing all original files.
Why is this happening?
The "Knit HTML" button in RStudio was only saving the Rmd and html files, not the intermediate md file. I ran the knit command in the console, which saved the .md file to my working directory.

Can not find post file in github by using jekyll

This is my github pages . I have already create gh-pages brench.
I want to create markdown file and use jekyll to convert it to .html file.
It can be successfully shown on my localhost.
(auto-generate _site and .html pages)
But I upload the whole directory to github .
The index file can be loaded , but post file cannot.
(click the post link,it show 404 error page.)
What happened to this ?
This is my jekyll github link:
https://github.com/larrywhy/jekylldemo/blob/gh-pages/index.html
This is my pages:
http://larrywhy.github.io/jekylldemo/
At _config.yml file, change the baseurl from "/jekyll_demo" to "/jekylldemo".
You misspelled.