Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<!--more--> dose not work at .Rmd #330

Closed
TonyFly3000 opened this issue Aug 29, 2018 · 4 comments
Closed

<!--more--> dose not work at .Rmd #330

TonyFly3000 opened this issue Aug 29, 2018 · 4 comments
Milestone

Comments

@TonyFly3000
Copy link

TonyFly3000 commented Aug 29, 2018

dose not work at .Rmd for theme hyde-hyde

same as
#21

it can be slightly modified in .md documents by adding a tag below content you wish to be included. This tag doesn't seem to work on blogdown-generated .Rmd files, causing the default summary to be the first 70 words of the post (which often includes the table of contents and other materials that aren't appropriate for a summary).

@cderv
Copy link
Collaborator

cderv commented Aug 29, 2018

There are some other related issue on this point #142 and #92 with some interesting answer.
In fact, there is also a blogpost on this specific subject of summary and the approach I believe has been recommended for blogdown
https://yihui.name/en/2017/08/hugo-post-summary/

@TonyFly3000
Copy link
Author

TonyFly3000 commented Aug 30, 2018

Thanks Yihui ,Christophe for the great package and respond .
I did read yihui blog. and follow the same guideline . But the .Rmd still show first 70 words of the post (which often includes the table of contents and other materials that aren't appropriate for a summary).

And I found out that "< !--more-->" work on .Rmarkdown .for now I may just use .Rmarkdown instead of .Rmd

in .Rmd I changed to

title: test002
author: ''
date: '2018-08-30'
slug: test002
categories: []
tags: []
lastmod: '2018-08-30T01:24:02+08:00'
layout: post
type: post
highlight: no
description: 'Wonder how I set up this website using just GitHub pages Hugo'

in themes\hyde-hyde\layouts_default\list.html I changed to

{{ define "header" }}
{{ partial "header.html" . }}
{{ end }}

{{ define "content" }}
{{ partial "page-list/content.html" . }}
{{ end }}

{{ define "footer" }}
{{ partial "page-list/footer.html" . }}
{{ end }}

{{ with .Description }}
{{ $.Scratch.Set "summary" (markdownify .) }}
{{ else }}
{{ $.Scratch.Set "summary" ((delimit (findRE "(<p.?>(.|\n)?

\s*)+" .Content) "[…] ") | plainify | truncate (default 200 .Site.Params.summary_length) (default " …" .Site.Params.text.truncated ) | replaceRE "&" "&" | safeHTML) }}
{{ end }}
{{ $.Scratch.Get "summary" }}

@cderv
Copy link
Collaborator

cderv commented Aug 30, 2018

{{ with .Description }}
{{ $.Scratch.Set "summary" (markdownify .) }}
{{ else }}
{{ $.Scratch.Set "summary" ((delimit (findRE "(<p.?>(.|\n)?
\s*)+" .Content) "[…] ") | plainify | truncate (default 200 .Site.Params.summary_length) (default " …" .Site.Params.text.truncated ) | replaceRE "&" "&" | safeHTML) }}
{{ end }}
{{ $.Scratch.Get "summary" }}

It is not exactly the same as in the example in #92 - some * characters and a </p> are missing for example.

    {{ with .Description }}
      {{ $.Scratch.Set "summary" (markdownify .) }}
    {{ else }}
      {{ $.Scratch.Set "summary" ((delimit (findRE "(<p.*?>(.|\n)*?</p>\\s*)+" .Content) "[&hellip;] ") | plainify | truncate (default 200 .Site.Params.summary_length) (default " &hellip;" .Site.Params.text.truncated ) | replaceRE "&amp;" "&" | safeHTML) }}
    {{ end }}
{{ $.Scratch.Get "summary" }}

Did you try exactly as proposed ? I assumed it should work as is before any modification.

.Rmarkdown is a solution as it uses the default Hugo generator and not pandoc, the generator for rmarkdown package. I assume Hugo knows how to deal with your <!--more--> tag.
See blogdown chapter for differences.

@TonyFly3000
Copy link
Author

TonyFly3000 commented Aug 30, 2018

Thanks .now I know the difference between .Rmd and .Rmarkdown.

Problem Solved !!!

@yihui yihui added this to the v0.8 milestone Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants