toto icon indicating copy to clipboard operation
toto copied to clipboard

doesn't point to the post url

Open rodrigoalvesvieira opened this issue 15 years ago • 14 comments

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 :-)

rodrigoalvesvieira avatar Feb 09 '10 23:02 rodrigoalvesvieira

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.

hyperbolist avatar Feb 10 '10 05:02 hyperbolist

I beg to differ. Simply naming the articles with that format does not fix the issue.

resistorsoftware avatar Feb 10 '10 15:02 resistorsoftware

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

ghost avatar Feb 11 '10 17:02 ghost

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.

resistorsoftware avatar Feb 22 '10 19:02 resistorsoftware

use article.path, article.url is the permalink.

cloudhead avatar Feb 23 '10 01:02 cloudhead

nice.

rodrigoalvesvieira avatar Feb 23 '10 01:02 rodrigoalvesvieira

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

bradphelan avatar Mar 15 '10 13:03 bradphelan

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.

cloudhead avatar Mar 15 '10 16:03 cloudhead

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...

resistorsoftware avatar Mar 15 '10 16:03 resistorsoftware

Ah. I see. Silly me. Why is article.path not drawn from the file name instead of the title metadata or automatically routed somehow?

bradphelan avatar Mar 15 '10 16:03 bradphelan

Yea, this is an area which needs some improvement, if you have any suggestions on how to make this easier, I'm all ears.

cloudhead avatar Mar 15 '10 16:03 cloudhead

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?

bradphelan avatar Mar 15 '10 16:03 bradphelan

The issue is obviously in mistakes with metadata and filename correlation. And it's really old. I believe this issue may be closed :))

ixti avatar Aug 10 '11 00:08 ixti

Any update?

asselinpaul avatar Dec 14 '12 15:12 asselinpaul