Closed henrywangnl closed 3 years ago
Can you try adding
```{=html}
<!-- wp:more -->
<!--more-->
<!-- /wp:more -->
or whatever the html is in your current posts (view source) that allows to get the read more.
yes, it works! Thanks!
Cool. If you want to make a PR to add that to the goodpress.Rmd, you're welcome to do that 🙂
Would it make sense to create a function goodpress::read_more() so one would add in index.Rmd
`r goodpress::read_more()`
Instead of remembering the syntax? It would produce the right lines in index.md
That's be nice.
Also, I notice that you have a Wordpress Document
template, which I think is a good idea to include more information.
For example, the YAML header could be more specific. This issue can also be included. Plus, how to publish the post. Now I'm maintaining a separate R file includes:
library(goodpress)
post_folder <- "/Users/henry/R/Blog/20200625"
wordpress_url <- "https://henrywang.nl"
wp_post(post_folder, wordpress_url)
Hope it can give some hints.
What template are you referring to?
Cool. If you want to make a PR to add that to the goodpress.Rmd, you're welcome to do that 🙂
Sure, I would like to do it!
oh right I started creating one! I should improve it, thanks.
Do you also want to create the function goodpress::read_more()
? It'd output text. Then the docs would mention it.
Not sure if I can do it. I would like to try it!
I can help, tell me what you (don't) know and I can provide links/tips in a couple of hours when I'm back at my desk. :-)
Thanks for the docs PR!
For adding a function I'd recommend
usethis::use_r("read-more")
read_more <- function() {
paste(
"```{=html}",
"<!-- wp:more -->",
"<!--more-->",
"<!-- /wp:more -->",
"```",
sep = "\n"
)
}
?read_more
remotes::install_local()
usethis::use_test("read-more")
e.g. test that the output is a string.Thanks! I will check it later. Never contribute to other packages before haha!
:grinning:
- try the function in an Rmd.
Hi Maelle,
I'm in this step and I called the function like this:
goodpress::read_more()
The knitted output is a string like <!-- wp:more -->\n<!--more-->\n<!-- /wp:more -->
But I don't know how to control it is rendered as HTML tag instead of such a string.
Do you have any idea?
Yes either use it inline or in a chunk with results='asis' (or is it result, not results?)
I can look more into it tomorrow.
have you tried using a chunk with results="asis" or to use it in inline code?
yes, you are right.
The inline code of r goodpress::read_more()
works! I can add it for the next PR.
Thanks!
yay :tada:
Hi Maëlle,
Do you know if I can have a
read more
separator in R Markdown? I don't want to show the whole post on my homepage.Thanks