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

Post not shown if title contains : (colon) #549

Closed
Heliosmaster opened this issue Apr 30, 2012 · 17 comments
Closed

Post not shown if title contains : (colon) #549

Heliosmaster opened this issue Apr 30, 2012 · 17 comments

Comments

@Heliosmaster
Copy link

in the YAML front matter, if I have

title: "Post title : Part 1"

the post is not shown by Jekyll.

@nickcharlton
Copy link

An instant solution to this is to encode it yourself. A colon is: : as an entity.

See: http://stackoverflow.com/questions/10963002/jekyll-new-posts-not-being-generated

@prusswan
Copy link

+1

@Vanuan
Copy link

Vanuan commented Oct 6, 2012

The problem is it's hard to find which page contains colon. Jekyll produces exception:

/usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/psych-1.3.4/lib/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 4 column 14 (Psych::SyntaxError)
    from /usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/psych-1.3.4/lib/psych.rb:203:in `parse_stream'
    from /usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/psych-1.3.4/lib/psych.rb:151:in `parse'
    from /usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/psych-1.3.4/lib/psych.rb:127:in `load'
    from /usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/convertible.rb:33:in `read_yaml'

@Vanuan
Copy link

Vanuan commented Oct 6, 2012

When I use quotes around a title, the site is generated correctly.

@srubin
Copy link

srubin commented Dec 19, 2012

I had this problem when importing from a tumblr. To fix colons in titles (with python; I'm sure there's some one-liner to do this, but it works):

import re
import glob
colon = re.compile(r"title:(.*:.*)")
for file in glob.glob("_posts/tumblr/*.html"):
    with open(file) as f:
        lines = f.readlines()
    for i, line in enumerate(lines):
        match = colon.match(line)
        if match:
            lines[i] = "title:" + match.group(1).replace(":", "&#58;") + "\n"
            with open(file, "w") as f:
                print "updating ", file
                for line in lines:
                    f.write(line)

@nottrobin
Copy link

Instant help! Yay.

@parkr
Copy link
Member

parkr commented Mar 19, 2013

Unfortunately, Jekyll can't do much about this. It's really a YAML problem.

@parkr parkr closed this as completed Mar 19, 2013
@nottrobin
Copy link

Can Jekyll not even do anything useful about the error message? A meaningful error message would be really helpful.

@parkr
Copy link
Member

parkr commented Mar 20, 2013

@nottrobin On master, it looks like we give a more helpful error. Did you test on 1.0.0.beta2?

@sotayamashita
Copy link

👍

@gideonite
Copy link

I'm using jekyll 2.5.3 and I'm still getting an unhelpful error:

Error reading file /home/path/to/01-01-1900-init-my-first-post.md: (<unknown>): mapping values are not allowed in this context at line 3 column 12 

line 3 contains the title of the post which has a colon in it.

@parkr
Copy link
Member

parkr commented Jan 31, 2015

@gideonite We asked about this here, check it out: dtao/safe_yaml#54

@augustoproiete
Copy link

Also using jekyll 2.5.3 and the workaround I prefer, is to use the "non-specifig tag" YAML syntax.

---
title: ! 'Attention: This post title has "colon" & stuff'
date: 2015-05-24 11:12:13
---

This allows me to use colon, double quotes, and pretty much any special char.

michaelthorne added a commit to maban/styleguides that referenced this issue May 26, 2015
@fernandomantoan
Copy link

The syntax suggested by @caioproiete works for me.

@akhyarrh
Copy link

akhyarrh commented Oct 2, 2015

I use 'Title: subtitle' and "Title: subtitle" everything work fine

@pathawks
Copy link
Member

pathawks commented Oct 2, 2015

This issue is more than three years old; I would hope everything works fine.

@gurghet
Copy link

gurghet commented Jan 10, 2016

Quotes worked

@jekyll jekyll locked and limited conversation to collaborators Jan 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests