Tweak page description #2982

Merged
merged 2 commits into from Oct 8, 2014

Conversation

Projects
None yet
4 participants
@XhmikosR
Contributor

XhmikosR commented Oct 8, 2014

  1. remove unneeded end tags
  2. add strip_newlines in description (without this, I ended up with newlines inside the quotes)
  3. move X-UA-Compatible right after meta charset

XhmikosR added some commits Oct 8, 2014

site_template/_includes/head.html: Minor refactoring.
Remove unneeded end tag, and also strip newlines.
Move `X-UA-Compatible` just after `meta charset`.
@nternetinspired

This comment has been minimized.

Show comment
Hide comment
@nternetinspired

nternetinspired Oct 8, 2014

Contributor

Good call, strip_newlines is a good addition.

Contributor

nternetinspired commented Oct 8, 2014

Good call, strip_newlines is a good addition.

@@ -7,7 +7,7 @@ layout: null
<title>{{ site.title | xml_escape }}</title>
<description>{{ site.description | xml_escape }}</description>
<link>{{ site.url }}{{ site.baseurl }}/</link>
- <atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml" />
+ <atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml"/>

This comment has been minimized.

@parkr

parkr Oct 8, 2014

Member

?

This comment has been minimized.

@XhmikosR

XhmikosR Oct 8, 2014

Contributor

Unneeded space before the end tag.

@XhmikosR

XhmikosR Oct 8, 2014

Contributor

Unneeded space before the end tag.

This comment has been minimized.

@parkr

parkr Oct 8, 2014

Member

Oh, do you think it helps at all for readability? I find it more readable with the space than without, but it could be just me.

@parkr

parkr Oct 8, 2014

Member

Oh, do you think it helps at all for readability? I find it more readable with the space than without, but it could be just me.

This comment has been minimized.

@XhmikosR

XhmikosR Oct 8, 2014

Contributor

To me it's the same, plus this is the only place with a space before the end tag.

@XhmikosR

XhmikosR Oct 8, 2014

Contributor

To me it's the same, plus this is the only place with a space before the end tag.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Oct 8, 2014

Member

Cool, looking good.

Member

parkr commented Oct 8, 2014

Cool, looking good.

@parkr parkr self-assigned this Oct 8, 2014

@parkr parkr merged commit 70174e8 into jekyll:master Oct 8, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

parkr added a commit that referenced this pull request Oct 8, 2014

@XhmikosR XhmikosR deleted the XhmikosR:page-description branch Oct 8, 2014

@amw

This comment has been minimized.

Show comment
Hide comment
@amw

amw May 9, 2016

strip_newlines removes the "\n" characters instead of replacing them with spaces. This creates word run-ins in markdown content. Source:

This is an example paragraph
that is broken into a few
lines. New lines render as
spaces in HTML.

This is rendered as This is an example paragraphthat is broken into a fewlines. New lines render asspaces in HTML in the meta tag.

I reproduced this on a brand new jekyll site by adding this as the first paragraph to the "welcome-to-jekyll.markdown" post.

I think the solution is to either keep the newlines inside the description meta tag or replace it with a custom liquid filter like this one:

  def newlines_to_spaces input
    input.to_s.gsub(/\r?\n/, ' '.freeze)
  end

amw commented May 9, 2016

strip_newlines removes the "\n" characters instead of replacing them with spaces. This creates word run-ins in markdown content. Source:

This is an example paragraph
that is broken into a few
lines. New lines render as
spaces in HTML.

This is rendered as This is an example paragraphthat is broken into a fewlines. New lines render asspaces in HTML in the meta tag.

I reproduced this on a brand new jekyll site by adding this as the first paragraph to the "welcome-to-jekyll.markdown" post.

I think the solution is to either keep the newlines inside the description meta tag or replace it with a custom liquid filter like this one:

  def newlines_to_spaces input
    input.to_s.gsub(/\r?\n/, ' '.freeze)
  end
@amw

This comment has been minimized.

Show comment
Hide comment
@amw

amw May 9, 2016

I've opened a new issue since this PR has been closed for so long.

amw commented May 9, 2016

I've opened a new issue since this PR has been closed for so long.

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