# Webby 0.7.2

**URL:** <https://www.ruby-forum.com/t/webby-0-7-2/127952>\
**Category:** Ruby\
**Created:** [February 3, 2008, 3:04am UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952 "2008-02-03T03:04:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 3, 2008, 3:04am UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/1 "2008-02-03T03:04:54Z")

</div>

== Webby  
by Tim P.  
[http://webby.rubyforge.org](http://webby.rubyforge.org)

== Description

Webby builds websites. It’s not a framework. It’s not a webserver.  
It’s not a content management system.

Webby builds websites very, very well.

Webby will take text files written in your favorite markup language,  
combine them with some fancy layouts, and output HTML files. You can  
upload these HTML files to a webserver, and PRESTO!!! There’s your  
website!

Webby makes it dead simple to do all this.

Webby has documentation (in progress).

Webby has friends:

[http://www.codefluency.com/](http://www.codefluency.com/)  
[http://lug.boulder.co.us/](http://lug.boulder.co.us/)  
[http://webby.rubyforge.org/](http://webby.rubyforge.org/)  
[http://www.pea53.com/](http://www.pea53.com/) ← my personal site that is still just  
Lorem Ipsum right now

Webby needs to be installed on your computer right now!

sudo gem install -y webby

== Changes

- 4 minor enhancements
  - Created a URI base path rewriter filter
  - Create an outline filter for generating table of contents
  - Pages can be created as files or as directories
  - The @pages find method now recurses into sub-directories

- 3 bug fixes
  - Fixed a bug in the graphviz filter where the wrong map ID was  
being generated
  - Now passing the binding of the Renderer to the HAML filter  
(this makes the @page, @pages availabe in HAML pages)
  - The created\_at attribute was not being created as a YAML  
time object

== Enjoy

== Fun Fact

American Airlines saved $40,000 in 1987 by eliminating 1 olive from  
each salad served in first-class.

== Post Script

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 15, 2008, 12:16pm UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/2 "2008-02-15T12:16:36Z")

</div>

On Sun, Feb 3, 2008 at 4:03 AM, Tim P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> == Webby  
> by Tim P.  
> [http://webby.rubyforge.org](http://webby.rubyforge.org)

Is there a forum or wiki for Webby? I have some more questions:

1. Is there a directory in the webby structure where I can put files  
to be copied into  
output during a build? I currently put images directly under  
output/img, which seems wrong.
2. How do you create links to other content pages without specifying  
the URL directly?
3. How do I add file dependencies to the build? ie. I have created a  
scripts directory so  
that in my default.rhtml I can ‘require “scripts/utils.rb”’ and use  
those methods, but  
‘rake autobuild’ doesn’t pick up changes to them.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 15, 2008, 12:53pm UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/3 "2008-02-15T12:53:15Z")

</div>

On Fri, Feb 15, 2008 at 1:15 PM, Leslie V.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Sun, Feb 3, 2008 at 4:03 AM, Tim P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > == Webby  
> > by Tim P.  
> > [http://webby.rubyforge.org](http://webby.rubyforge.org)
> 
> Is there a forum or wiki for Webby? I have some more questions:

Ok, I figured out all the answers by looking at the example, except for:

> 1. How do you create links to other content pages without specifying  
> the URL directly?

I see there is an @pages variable but not quite sure how to access an  
individual page (and then page.url) therein.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 15, 2008, 1:03pm UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/4 "2008-02-15T13:03:16Z")

</div>

On Fri, Feb 15, 2008 at 1:52 PM, Leslie V.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> Ok, I figured out all the answers by looking at the example, except for:
> 
> > 1. How do you create links to other content pages without specifying  
> > the URL directly?

Oh, read the source for url\_helper.rb and figured that out too:

\<%= link\_to\_page(“click here”, :title =\> “Management”) %\>

It sure is great when everything is written in Ruby.

Thanks Tim, and I am looking forward to Webby’s manual being complete!  
(maybe I can add to it a bit and send diffs?)

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 17, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/5 "2008-02-17T22:42:00Z")

</div>

On Feb 15, 2008 6:18 PM, Tim P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 1. How do you create links to other content pages without specifying  
> > the URL directly?
> 
> \<%= link\_to\_page( :title =\> “Your Page Title” ) %\>

Because the “url\_for” function produces url’s that start with a “/”,  
I cannot open my generated index.html as a file on my harddrive -  
all the links are absolute. I changed the url\_for function to leave  
out the leading slash and now everything seems to work locally  
and through a server. Can you think of a problem this may cause?

> Thanks for enjoying webby 🙂 It’s been fun to write and fun to use.  
> If you want to add updates to the manual, grab the latest version from  
> the RubyForge svn and shoot me a diff file.

I hope I can contribute once I have made some progress myself. There’s  
a lot more that can be put in there.

Webby is quite a bit of fun so far! I’ll post a link when my site is up.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 15, 2008, 5:19pm UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/6 "2008-02-15T17:19:40Z")

</div>

On Feb 15, 2008, at 4:15 AM, Leslie V. wrote:

> Is there a forum or wiki for Webby? I have some more questions:

I should probably make one.

> 1. Is there a directory in the webby structure where I can put files  
> to be copied into  
> output during a build? I currently put images directly under  
> output/img, which seems wrong.

Put them in the content folder. The files will be copied to the output  
folder when the website is built.

> 1. How do you create links to other content pages without specifying  
> the URL directly?

\<%= link\_to\_page( :title =\> “Your Page Title” ) %\>

That will find the page that has “Your Page Title” as the value for  
the “title” meta-data attribute. It will use the title as the name for  
the anchor tag. However, you can also specify your own name to use as  
you discovered and replied in one of your response e-mails.

> 1. How do I add file dependencies to the build? ie. I have created a  
> scripts directory so  
> that in my default.rhtml I can ‘require “scripts/utils.rb”’ and use  
> those methods, but  
> ‘rake autobuild’ doesn’t pick up changes to them.

Custom extensions go in the “lib” folder. Any .rb files in there will  
be loaded when the rake tasks are run (build, rebuild, autobuild). I  
put things in there like code to create breadcrumb links or monkey  
patches to the webby source code.

Thanks for enjoying webby 🙂 It’s been fun to write and fun to use.  
If you want to add updates to the manual, grab the latest version from  
the RubyForge svn and shoot me a diff file.

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 18, 2008, 10:41am UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/7 "2008-02-18T10:41:38Z")

</div>

On Feb 17, 2008 11:41 PM, Leslie V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> out the leading slash and now everything seems to work locally  
> and through a server. Can you think of a problem this may cause?

Here’s the code:  
def url\_for( \*args )  
opts = Hash === args.last ? args.pop : {}  
obj = args.first

```
anchor = opts.delete(:anchor)
escape = opts.has_key?(:escape) ? opts.delte(:escape) : true

url = Webby::Resource === obj ? obj.url : obj.to_s
url = escape_once(url) if escape
url << "#" << anchor if anchor

url = url[1..-1] if url.length > 1
return url

```

end

… I just added the third-last line. Perhaps better would be to change  
obj.url for each object.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 19, 2008, 12:53am UTC](https://www.ruby-forum.com/t/webby-0-7-2/127952/8 "2008-02-19T00:53:14Z")

</div>

On Feb 17, 2008, at 2:41 PM, Leslie V. wrote:

> out the leading slash and now everything seems to work locally  
> and through a server. Can you think of a problem this may cause?

I can’t think of a problem that it will cause, but I also can’t think  
of a problem it will solve, either. Your fix will work for pages  
located at the root of the website. But for pages that are nested in  
some directory structure, they will not have access to the CSS files  
or other resources. The reason for this is that the layout contains  
the HTML head tag, and that will be the same for all the pages. When  
it is configured to work for one directory level, it will not work for  
any other directory levels.

Webby has a “basepath” filter that allows you to rewrite the base path  
for any URL in the system. I use this filter for websites that are not  
hosted at the root of the web server. This filter looks at all the  
URLs in a page and replaces that leading slash “/” character with the  
new base path.

In your situation, you could rewrite the base URL to “.”

rake rebuild BASE="."

That will work for viewing pages directly from the disk. However, you  
will run into the problem where pages nested in some directory won’t  
be able to load the CSS files, etc.

Blessings,  
TwP
