Open rodrigoalvesvieira opened 14 years ago
I had the same initial experience. Make sure the files in /articles are named yyyy-mm-dd-title.txt
and links to your articles from the index should start working. The rake new
task assists in this case, ensuring that the file is properly named.
I beg to differ. Simply naming the articles with that format does not fix the issue.
Make sure the meta in the text file matches the filename. So if the filename is: 2010-02-11-this-is-a-post.txt the meta inside the file should be:
date: 2010/02/11 title: This is a post
alternatively, you can have a different "title", just add a slug with the same name as a file -- this will be used as the permalink for the post:
slug: this-is-a-post
This issue has seemingly come back to haunt? Something has changed whereby articles are no longer linking properly. I am using article.url in my HAML and the link looks fine.. but the internals are throwing 404 errors again.
use article.path
, article.url
is the permalink.
nice.
I'm seeing the same thing. I've got an article with metadata
title: temporarily modifying a ruby attribute date: 15/03/2010
in a file called
articles/2010-03-15-temporarily-modifying-an-attribute.txt
I generated the file with rake new and now I get the above 404 related problem.
live site with problem is http://xtargets.heroku.com/ if it helps diagnose.
http://xtargets.heroku.com/2010/03/15/temporarily-modifying-a-ruby-attribute/
is the problem URL
Your url slug and article name doesn't match, if you go here:
http://xtargets.heroku.com/2010/03/15/temporarily-modifying-an-attribute/
It works fine.
One comment about using article.path instead of article.url. It seems Toto currently does not respect the url. Eg... set :url, http://www.foo.com/bloggy if you use article.path you'll generate 404 errors when it tries to render http://www.foo.com/some-article-here instead of http://www.foo.com/bloggy/some_article_here of course YMMV but I found this to be the case.. I pasted a /bloggy into my HAML template before article.path.... yeck... but it worked...
Ah. I see. Silly me. Why is article.path not drawn from the file name instead of the title metadata or automatically routed somehow?
Yea, this is an area which needs some improvement, if you have any suggestions on how to make this easier, I'm all ears.
In the spirit of less whinging more patching.
----------------------
/usr/lib/ruby/gems/1.8/gems/toto-0.4.3/lib/toto.rb
----------------------
93 def article route
94 begin
95 Article.new("#{Paths[:articles]}/#{route.join('-')}.#{self[:ext]}", @config).load
96 rescue
97 Site.articles(@config[:ext]).reverse.map do |a|
98 Article.new(a, @config)
99 end.first do |article|
100 article.title == route
101 end.load
102 end
103 end
can use the title to look up the file name. The above code is not really fast but once loaded the caching takes over so is it a problem?
The issue is obviously in mistakes with metadata and filename correlation. And it's really old. I believe this issue may be closed :))
Any update?
Hello everyone, this is a kinda weird issue. I create a new .txt file in /articles and add to git, commit and push it, then I go to the blog home page, and the description of the new post is there, but when I click to see the entire post in Chrome it says "Oops! This link appears to be broken." and Firefox gives me a 404 error (toto, we're not in Kansas anymore (404)), what is this?
P.S: The blog http://neorubyist.heroku.com/
Thanks :-)