Welcome to Webby installation. This first post is in textile.
Running command webby-gen blog rubytester_blog creates a rubytester_blog directory with all the scaffolding necessary for the webby site. The content directory has only css/blueprint and there is no blog directory. At this point run webby with -T switch to see what tasks are available to move forward.
$ webby -T webby autobuild # Continuously build the website webby blog:post # Create a new blog post webby build # Build the website webby clobber # Delete the website webby create:atom_feed # Create a new atom_feed webby deploy # deploy the site to the webserver webby deploy:rsync # Deploy to the server using rsync webby deploy:ssh # Deploy to the server using ssh webby rebuild # Rebuild the website webby validate # Alias to validate:internal webby validate:external # Validate hyperlinks (include external sites) webby validate:internal # Validate hyperlinks (exclude external sites)
Let’s make this blog post.
Running the following command creates 3 files.
$ webby blog:post "my first fake post with webby" content/blog/2009/04/13/my-first-fake-post-with-webby.txt content/blog/2009/04/index.txt content/blog/2009/index.txt
This blog post file. this month index.txt file and this year index file. OK, so far so good. I understand the basic pattern (I think)
The default content for this blog was taken from /templates/blog/post.erb the month index from month.erb and 2009/index.txt from year.erb
so let’s do webby build task to generate a site
Generated SITE
I will refer to the webby site as SITE. I think webby itself refers to it as SITE anyway.
So to view the new SITE statically I encounter a problem. All the css is broken because looking at layout/default.txt all the href begins with /css/bla/bla. I can fix it be changing it all to ../css/bla/bla or I can use the server provided by webby by running webby autobuild
Let’s do ‘autobuild’. It uses ‘directory_watcher’ to scan for changes and automatically builds your site for you when it encouters a fresh page. That is an awesome feature. I think I’ll stick with that. My local site is now available at http://localhost:4331/
Next problem to overcome is lack of site index file. I’ll build it next and display a lis of posts.
page meta
Before building a home page let’s take a look at the page meta. this page got created with the yaml section that holds metadata for the page. Now I wonder about options becuse I have seen keys like layout: index and dirty: true so I wonder where I can quickly find that info hm… dubi dam dam dubi dam… OK… Webby::Resources::MetaFile class has some mention of it. I see I can use tags outlines slides and other things. This will be worth exploring later. First I got to make some sensible layout and a index home page file.
building a home page
I have two choices I think here. I can make a /content/blog/index page which will become a site home page or just make a blog/index for blog home page. Let’s do a blog specific home page first to display the list of blog posts, all? just the latest few? Maybe have some summary with title link? ok…
This ruby incantation returns all the posts in blog direcotry sans all index.txt files that hold year and month indices.
posts = @pages.find( :all, :in_directory => @page.dir, :recursive => true, :sort_by => "created_at", :reverse => true){|p| p.path !~ /\/index\.txt$/}
Now I need to print out each page. Let’s use HAML for the index. It will force me to learn it.
…do do do… do some more… ok, done for now. the index is done to display the list of posts.
Let’s make another fake posts to see that the second post also gets created.
… let’s move to the second post then.
blog comments powered by Disqus