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

Adding a cover image prints some extra characters #222

Closed
jormtz opened this issue May 2, 2019 · 8 comments
Closed

Adding a cover image prints some extra characters #222

jormtz opened this issue May 2, 2019 · 8 comments

Comments

@jormtz
Copy link

jormtz commented May 2, 2019

I was testing out the latest release with my blog, and noticed a string of characters ('>'>) being printed at the top of some pages. After messing around with my .Rmd files, I observed a pattern: only the posts with the cover option in the YAML header present this problem.

Finally, I built the example site and there it is:

Captura

I wonder: is this a bug or a problem with my local copy?
Sorry if this isn't helpful enough: this the first time I open an issue!
Cheers.

MunifTanjim added a commit that referenced this issue May 2, 2019
@MunifTanjim
Copy link
Owner

@jormtz Thanks for reporting! It should be fixed now.

@jormtz
Copy link
Author

jormtz commented May 3, 2019

Thanks!

@jormtz jormtz closed this as completed May 3, 2019
@singhkays
Copy link

Oh sweet! This was driving me crazy and I couldn't figure out what was causing it

@singhkays
Copy link

singhkays commented May 9, 2019

@MunifTanjim It doesn't look like this solved it. It went from 2 '>' to 1 and replaced the favicon on my blog where I'm using cover image

Example article with cover image - https://www.singhkays.com/blog/its-time-replace-gifs-with-av1-video/
Example article without cover image and correct favicon - https://www.singhkays.com/blog/detect-rolling-credits-video-indexer/

@MunifTanjim
Copy link
Owner

MunifTanjim commented May 15, 2019

@singhkays Probably coming from your template overrides?

@singhkays
Copy link

singhkays commented May 15, 2019

@MunifTanjim Any idea how I can figure this out? It only happens on articles using a cover image. I only have two overrides

layouts\partials\data\title

{{- $title := ( .Title ) -}}
{{- $siteTitle := ( .Site.Title ) -}}
{{- $sep := ( .Site.Params.seo.titleSeparator | default "•" ) -}}
{{- $title404 := ( .Site.Params.info.title404 | default $title ) -}}

{{- if .IsHome -}}
  {{ $siteTitle }}
{{- else if eq .Kind "404" -}}
  {{ $title404 }} {{ $sep }} {{ $siteTitle }}
{{- else if eq .Kind "taxonomy" -}}
  {{- ( ( i18n .Data.Singular 1 ) | default .Data.Singular ) -}}
  {{- print ": " -}}
  {{- if eq .Data.Singular "author" -}}
    {{- partial "data/author/displayName" . -}}
  {{- else -}}
    {{- $title -}}
  {{- end -}}
  {{- print " " $sep " " $siteTitle -}}
{{- else if ( or .IsNode ( eq .Section "page" ) ) -}}
  {{ $title }} {{ $sep }} {{ $siteTitle }}
{{- else -}}
  {{ $title }}
{{- end -}}

layouts\partials\head\opengraph\twitter.html

<meta name='twitter:card' content='summary_large_image'>

{{- with .Site.Params.opengraph.twitter.page -}}
  <meta name='twitter:site' content='@{{- . -}}'>
{{- end -}}

{{- range $authorID := .Params.authors -}}
  {{- $author := ( index $.Site.Data.authors $authorID ) -}}
  {{- with $author.social.twitter -}}
    <meta name='twitter:creator' content='@{{- . -}}'>
  {{- end -}}
{{- end -}}

{{- with .Params.cover -}}
  {{- $type := ( printf "%T" . ) -}}
  {{- $isMap := ( not ( eq $type "string" ) ) -}}

  {{- $image := "" -}}
  {{- if $isMap -}}
    {{- $image = .image -}}
  {{- else -}}
    {{- $image = . -}}
  {{- end -}}'>

  {{- $image = ( replaceRE "^\\./" $.RelPermalink $image ) -}}

  <meta property='twitter:image' content='{{- $image | absURL -}}'>
  {{- if $isMap -}}
    {{- with .caption -}}
    <meta property='twitter:image:alt' content='{{ . | markdownify }}'>
    {{- end -}}
  {{- end -}}
{{- end -}}

@MunifTanjim
Copy link
Owner

@singhkays

  {{- $image := "" -}}
  {{- if $isMap -}}
    {{- $image = .image -}}
  {{- else -}}
    {{- $image = . -}}
  {{- end -}}'> <--------------------- extra '> characters

@singhkays
Copy link

@MunifTanjim Awesome! That fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants