Hello, what exactly a block is? Do you explain it on the website? You wrote that a page file can contain multiple blocks. But why is it good? Please provide an example, how to use blocks. I have a code snippet, which I use on a lot of pages (Google Analytics and Adsense code). But if I change this snippet, of course I dont want to change every pages which uses it. I would like to change this snippet only in one file, then all the pages which use this snippet could just insert the snippet. For example, I would like to insert my Google Analytics tracking code snippet into all pages. How to do this? In which file should I put my Analytics snippet? My website uses multiple templates. I mean there are pages which have menu. But for example the first index page is a standalone page, whithout menu. And I have more standalone pages, only accessible from the sitemap page. Now how to insert the analytics code into all pages? And if I have an adsense code snippet, but I don''t want to insert it into all pages, just into specific pages, how to do this? (Page = a standalone HTML page) My final issue: where are the sources of example websites, generated with webgen? There is this page: http://webgen.rubyforge.org/documentation/0.4.x/examples/index.html But this page contains only the output! Where are the source files of these websites? I checked webgen-0.5.7.zip, it contains some sources. But in data/webgen. But for example the data\webgen\website_templates\project\ website contains only page files! Webgen cannot generate the output whithout the template file. Also there are no CSS in that folder. So am I dumb, or where to find working source file examples, not just the output? Best Regards, Bence
> what exactly a block is? Do you explain it on the website?A block is the smallest unit of content of a page file. Normally, you have one main block named `content` which holds the body of the page. And then you may have additional blocks for specific duties, e.g. for showing something on the sidebar.> You wrote that a page file can contain multiple blocks. But why is it > good? Please provide an example, how to use blocks.The typical example for using multiple blocks in page files is to that you have a template which layouts your website in two parts: the main content and a sidebar. The `content` block of a page file is used to populate the main content section and the optional `sidebar` block is used to additionally provide content for the sidebar. This is done on the webgen homepage, for example. You can see that there is some information regarding the latest version of webgen on the front page but not on the other pages. This is done by conditionally including a block of the page file that represents the front page.> I have a code snippet, which I use on a lot of pages (Google Analytics > and Adsense code). But if I change this snippet, of course I dont want > to change every pages which uses it. I would like to change this > snippet only in one file, then all the pages which use this snippet > could just insert the snippet. > > For example, I would like to insert my Google Analytics tracking code > snippet into all pages. How to do this? In which file should I put my > Analytics snippet? My website uses multiple templates. I mean there > are pages which have menu. But for example the first index page is a > standalone page, whithout menu. And I have more standalone pages, only > accessible from the sitemap page. Now how to insert the analytics code > into all pages?If you want to put something into all your pages, you should put it into your `default.template` file. Although you use various other templates to define the look and feel of your website, you can still have one template (the default template) into which they are rendered. For example, your `default.template` may look like this: <html lang="{lang:}"> <head><title>{title:}</title> <body> <webgen:block name="content" /> --- GOOGLE ANALYTICS/ADSENSE CODE --- </body> </html> Note that this is just a very crude example. You would definitely have more information in the `head` section. And if you want to have different head sections for different layout template, you could do this by inserting a block like this: <webgen:block name="head-section" notfound="ignore" /> This would insert the block name `head-section` but only if there is such a block - otherwise this line is ignored.> And if I have an adsense code snippet, but I don''t want to insert it > into all pages, just into specific pages, how to do this?You could add a second block named `adsense` to the `default.template` and insert it into the `content` block only if the node that is rendered has some meta information set: <% if context.content_node[''adsense_enabled''] %> <webgen:block name="adsense" chain="<%= context[:chain].first.absolute_lcn %>" / <% end %> This snippet would insert the block named `adsense` if the meta information `adsense_enabled` is set to `true` in a page file. The ERB code for the `chain` is needed because you need to insert a block that is in the currently processed file and not in the next file of the node chain. I have put an item on my TODO list which will make this easier by allowing to set the `node` attribute to `current`.> (Page = a standalone HTML page) > > My final issue: where are the sources of example websites, generated > with webgen? There is this page: > http://webgen.rubyforge.org/documentation/0.4.x/examples/index.html > But this page contains only the output! Where are the source files of > these websites? I checked webgen-0.5.7.zip, it contains some sources. > But in data/webgen. But for example the > data\webgen\website_templates\project\ website contains only page > files! Webgen cannot generate the output whithout the template file. > Also there are no CSS in that folder.The source files for the examples are mostly generated, so you won''t find them in the webgen package (not even in the 0.4.x packages, there you will only find the code to generate the examples). The examples section is just a demonstration of the various website styles/templates that can be used for a webgen website. And since the examples are for the 0.4.x series, you could not use the without some slight changes. So there is no reason to look at them if you are working with the 0.5.x version of webgen. As for the source of the webgen website: it is split into three parts. One part is the pure documentation part which is also shipped with webgen. It can be found in the doc/ directory. The second part are the support files which are used by both the documentation part and the website part. These files can be found in the misc/ directory of the webgen distribution. The third part are the sources of the webgen website which are not shipped with webgen since it makes no sense. However, the sources are checked into the Git repository.The documentation part can be rendered by running rake htmldoc This will put the generated documentation into the htmldoc/ directory. The reason why you can only use the above command and not simply the webgen executable is that the setup for the documentation website and the homepage is a little bit more involved and I didn''t want to have two extra configuration files lying around. Best regards, Thomas
Hi Thomas, thank you very much for your detailed response! What I would like is to have different example website generated by webgen. But I need their source files, not the output, since I can generate the output if I have the sources. So please if someone could send me complete website sources for webgen, I would appreciate it. Because just the output is useless. If you generated a website with webgen, please share the sources with the list! Regards, Bence On Wed, Mar 25, 2009 at 7:07 AM, Thomas Leitner <t_leitner at gmx.at> wrote:>> what exactly a block is? Do you explain it on the website? > > A block is the smallest unit of content of a page file. Normally, you > have one main block named `content` which holds the body of the page. > And then you may have additional blocks for specific duties, e.g. for > showing something on the sidebar. > >> You wrote that a page file can contain multiple blocks. But why is it >> good? Please provide an example, how to use blocks. > > The typical example for using multiple blocks in page files is to that > you have a template which layouts your website in two parts: the main > content and a sidebar. The `content` block of a page file is used to > populate the main content section and the optional `sidebar` block is > used to additionally provide content for the sidebar. > > This is done on the webgen homepage, for example. You can see that > there is some information regarding the latest version of webgen on the > front page but not on the other pages. This is done by conditionally > including a block of the page file that represents the front page. > >> I have a code snippet, which I use on a lot of pages (Google Analytics >> and Adsense code). But if I change this snippet, of course I dont want >> to change every pages which uses it. I would like to change this >> snippet only in one file, then all the pages which use this snippet >> could just insert the snippet. >> >> For example, I would like to insert my Google Analytics tracking code >> snippet into all pages. How to do this? In which file should I put my >> Analytics snippet? My website uses multiple templates. I mean there >> are pages which have menu. But for example the first index page is a >> standalone page, whithout menu. And I have more standalone pages, only >> accessible from the sitemap page. Now how to insert the analytics code >> into all pages? > > If you want to put something into all your pages, you should put it > into your `default.template` file. Although you use various other > templates to define the look and feel of your website, you can still > have one template (the default template) into which they are rendered. > For example, your `default.template` may look like this: > > ? ?<html lang="{lang:}"> > ? ? ?<head><title>{title:}</title> > ? ? ?<body> > ? ? ? ?<webgen:block name="content" /> > ? ? ? ?--- GOOGLE ANALYTICS/ADSENSE CODE --- > ? ? ?</body> > ? ?</html> > > Note that this is just a very crude example. You would definitely have > more information in the `head` section. And if you want to have > different head sections for different layout template, you could do > this by inserting a block like this: > > ? ?<webgen:block name="head-section" notfound="ignore" /> > > This would insert the block name `head-section` but only if there is > such a block - otherwise this line is ignored. > >> And if I have an adsense code snippet, but I don''t want to insert it >> into all pages, just into specific pages, how to do this? > > You could add a second block named `adsense` to the `default.template` > and insert it into the `content` block only if the node that is > rendered has some meta information set: > > ? ?<% if context.content_node[''adsense_enabled''] %> > ? ?<webgen:block name="adsense" chain="<%= context[:chain].first.absolute_lcn %>" / > ? ?<% end %> > > This snippet would insert the block named `adsense` if the meta > information `adsense_enabled` is set to `true` in a page file. The ERB > code for the `chain` is needed because you need to insert a block that > is in the currently processed file and not in the next file of the node > chain. I have put an item on my TODO list which will make this easier > by allowing to set the `node` attribute to `current`. > >> (Page = a standalone HTML page) >> >> My final issue: where are the sources of example websites, generated >> with webgen? There is this page: >> http://webgen.rubyforge.org/documentation/0.4.x/examples/index.html >> But this page contains only the output! Where are the source files of >> these websites? I checked webgen-0.5.7.zip, it contains some sources. >> But in data/webgen. But for example the >> data\webgen\website_templates\project\ website contains only page >> files! Webgen cannot generate the output whithout the template file. >> Also there are no CSS in that folder. > > The source files for the examples are mostly generated, so you won''t > find them in the webgen package (not even in the 0.4.x packages, there > you will only find the code to generate the examples). The examples > section is just a demonstration of the various website styles/templates > that can be used for a webgen website. And since the examples are for > the 0.4.x series, you could not use the without some slight changes. So > there is no reason to look at them if you are working with the 0.5.x > version of webgen. > > As for the source of the webgen website: it is split into three parts. > One part is the pure documentation part which is also shipped with > webgen. It can be found in the doc/ directory. The second part are the > support files which are used by both the documentation part and the > website part. These files can be found in the misc/ directory of the > webgen distribution. The third part are the sources of the webgen > website which are not shipped with webgen since it makes no sense. > However, the sources are checked into the Git repository.The > documentation part can be rendered by running > > ? ?rake htmldoc > > This will put the generated documentation into the htmldoc/ directory. > The reason why you can only use the above command and not simply the > webgen executable is that the setup for the documentation website and > the homepage is a little bit more involved and I didn''t want to have > two extra configuration files lying around. > > Best regards, > ?Thomas >
> So please if someone could send me complete website sources for > webgen, I would appreciate it. Because just the output is useless. > > If you generated a website with webgen, please share the sources with > the list!I have attached a zip file with the contents of the current webgen website (everything you see at http://webgen.rubyforge.org). Just unpack it, change into the extracted website directory and run webgen You need webgen 0.5.7 for this to work. -- Thomas -------------- next part -------------- A non-text attachment was scrubbed... Name: webgen-website.zip Type: application/octet-stream Size: 559568 bytes Desc: not available URL: <http://rubyforge.org/pipermail/webgen-users/attachments/20090325/b1ad45d7/attachment-0001.obj>
Thomas, This worked 99% and with great results! Couple error messages when running webgen: #1 An error has occurred: No such file or directory - /Users/thomasleitner/website/version.rb So, in webgen.cache, I replaced this: /Users/thomasleitner/website/version.rb With this: version.rb #2 |<webgen:block name=''content'' />An error has occurred: Erb processing failed in </documentation/reference_configuration.en.html>: no such file to load -- coderay I still get this message from webgen even after replacing this in all files: /documentation/reference_configuration.en.html With this: /documentation/reference_configuration.html Not sure where the effect of this problem will appear. Overall, the generated website looks great! Thank you! Rick -----Original Message----- From: webgen-users-bounces at rubyforge.org [mailto:webgen-users-bounces at rubyforge.org] On Behalf Of Thomas Leitner Sent: Wednesday, March 25, 2009 12:47 PM To: Bence Cc: webgen-users at rubyforge.org Subject: Re: [webgen-users] What is a block?> So please if someone could send me complete website sources for > webgen, I would appreciate it. Because just the output is useless. > > If you generated a website with webgen, please share the sources with > the list!I have attached a zip file with the contents of the current webgen website (everything you see at http://webgen.rubyforge.org). Just unpack it, change into the extracted website directory and run webgen You need webgen 0.5.7 for this to work. -- Thomas
> Couple error messages when running webgen: > #1 > An error has occurred: No such file or directory - > /Users/thomasleitner/website/version.rb > > So, in webgen.cache, I replaced this: > /Users/thomasleitner/website/version.rb > With this: > version.rbOkay, the problem is that I have included the webgen.cache file in the zip. Before running webgen just delete it, then the error above is fixed.> #2 > |<webgen:block name=''content'' />An error has occurred: Erb > processing failed in > </documentation/reference_configuration.en.html>: no such file to > load -- coderay > > I still get this message from webgen even after replacing this in all > files: /documentation/reference_configuration.en.html > With this: > /documentation/reference_configuration.htmlThe error comes from not having coderay installed. Since the webgen website showcases nearly all features of webgen, you need all optional dependencies installed for a successful run. This also means that you need a working LaTeX installation with TikZ for rendering the src/documentation/tag/tikz.page! -- Thomas