Thomas Leitner
2010-Feb-03 20:32 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
Hi everybody! As was discussed on the ML some time ago, there is sometimes the need for including custom links in the head section of an HTML document. For example: - adding links to javascript or CSS files - adding links to next/previous HTML documents - adding links to Atom/RSS feeds What I have in mind is a `link` meta information key: - Adding custom CSS/JS files (value is array or string): link: javascript: URI css: URI OR: link: javascript: [URI, URI] css: [URI, URI] - Adding other links: link: next: URI prev: href: URI title: Some title alternate: - type: atom/xml href: URI - type: text/css href: URI - Automatically adding links to same page in other languages: <link type="text/html" rel="alternate" hreflang="LANGCODE" href="URI" lang="LANGCODE" title="TITLE" /> use `lang` and `title` only if title of linked page is specified The meta information link has the special keys `javascript` and `css`, all other keys are taken to be link types (next, prev, start, ...) that are going into the `rel` attribute of the generated <link> tag. The value of such keys can be a string value (taken as value of the href attr), a hash (taken as attr name-value pairs) or an array or the former two (to create multiple such link types. If you have any comments/suggestions on the above, please write! I will implement the above in the coming days. Best regards, Thomas
Damien Pollet
2010-Feb-03 21:22 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Wed, Feb 3, 2010 at 21:32, Thomas Leitner <t_leitner at gmx.at> wrote:> If you have any comments/suggestions on the above, please write! I will > implement the above in the coming days.You have one tester (well, provided I can build my site at all :) -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-04 19:01 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Wed, 3 Feb 2010 22:22:33 +0100, Damien Pollet wrote:> On Wed, Feb 3, 2010 at 21:32, Thomas Leitner <t_leitner at gmx.at> wrote: > > If you have any comments/suggestions on the above, please write! I > > will implement the above in the coming days. > > You have one tester (well, provided I can build my site at all :)I have pushed the needed changes for this functionality to github and rubyforge. Comments/Suggestions et al are welcome! -- Thomas
Damien Pollet
2010-Feb-04 19:56 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
> I have pushed the needed changes for this functionality to github and > rubyforge. Comments/Suggestions et al are welcome!Is there an easy way to get a gem? I tried rake in a checkout and it says there''s no rdoc/task? -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-04 23:21 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Thu, 4 Feb 2010 20:56:31 +0100, Damien Pollet wrote:> > I have pushed the needed changes for this functionality to github > > and rubyforge. Comments/Suggestions et al are welcome! > > Is there an easy way to get a gem? > I tried rake in a checkout and it says there''s no rdoc/task?If you just want to run webgen, run the following in the checkout directory: ruby -rubygems -Ilib bin/webgen If you want to use the rake tasks, you should install the development dependencies (gem install --no-rdoc --no-ri webgen --development) - though there is not task for running webgen. Use `rake -T` to show the available tasks, `rake dev:gem` builds the gem. -- Thomas
Damien Pollet
2010-Feb-06 11:47 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Fri, Feb 5, 2010 at 00:21, Thomas Leitner <t_leitner at gmx.at> wrote:> On Thu, 4 Feb 2010 20:56:31 +0100, Damien Pollet wrote: >> > I have pushed the needed changes for this functionality to github >> > and rubyforge. Comments/Suggestions et al are welcome!Ok, seems to work fine. My only grief is that with Matteo''s blog code, the metadata is only set for the main blog page, not for the individual posts? I tried putting the data in the metainfo file, but - globs are not powerful enough to match the blog index and the posts (or I missed something) I could duplicate it but it''s ugly? - relocatable does not work in the metainfo, so the link is probably incorrect (posts are in subdirectories) Anyway, it''s now in use on my site :) -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-07 19:28 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
> My only grief is that with Matteo''s blog code, the metadata is only > set for the main blog page, not for the individual posts? I tried > putting the data in the metainfo file, but > - globs are not powerful enough to match the blog index and the posts > (or I missed something) > I could duplicate it but it''s ugly?You could try to use YAML aliases sothat you need to specify the meta info only once - see http://yaml.org/spec/1.0/#id2563922> - relocatable does not work in the metainfo, so the link is probably > incorrect (posts are in subdirectories)Just specify an absolute path starting with a slash (i.e. /path/to/feed.atom instead of to/feed.atom) - then the paths will always be correct.> Anyway, it''s now in use on my site :)Cool :-) -- Thomas
Damien Pollet
2010-Feb-08 10:53 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Sun, Feb 7, 2010 at 20:28, Thomas Leitner <t_leitner at gmx.at> wrote:> You could try to use YAML aliases sothat you need to specify the meta > info only once - see http://yaml.org/spec/1.0/#id2563922yay, another overly verbose and underly clear spec document? :)>> - relocatable does not work in the metainfo, so the link is probably >> incorrect (posts are in subdirectories) > > Just specify an absolute path starting with a slash > (i.e. /path/to/feed.atom instead of to/feed.atom) - then the paths will > always be correct.The problem is, if webgen translates those to absolute links in the html, it won''t work. I''m deploying the webgen output in a subtree of the complete site, and I have a test deployment on a local web server that does not have the same prefix. -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-08 20:20 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
> > Just specify an absolute path starting with a slash > > (i.e. /path/to/feed.atom instead of to/feed.atom) - then the paths > > will always be correct. > > The problem is, if webgen translates those to absolute links in the > html, it won''t work. I''m deploying the webgen output in a subtree of > the complete site, and I have a test deployment on a local web server > that does not have the same prefix.webgen translates internal paths *always* to relative paths! So it does not matter where you deploy your site, it will work everywhere. However, if you want absolute paths, it is also possible with a little patching (there was a mail exchange about this some time ago). -- Thomas
Damien Pollet
2010-Feb-09 16:04 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Mon, Feb 8, 2010 at 21:20, Thomas Leitner <t_leitner at gmx.at> wrote:>> The problem is, if webgen translates those to absolute links in the >> html, it won''t work. I''m deploying the webgen output in a subtree of >> the complete site, and I have a test deployment on a local web server >> that does not have the same prefix. > > webgen translates internal paths *always* to relative paths! So it does > not matter where you deploy your site, it will work everywhere. > However, if you want absolute paths, it is also possible with a little > patching (there was a mail exchange about this some time ago).No, relative is what I want. I just wasn''t sure it would do that everywhere. Actually the problem might be that I have a separate template file for the blog posts, and maybe the blog generator does not propagate all its metainfo. I didn''t take the time to look in detail, links on the main page are perfectly ok for the moment. -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Damien Pollet
2010-Feb-22 16:10 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
Back on this? I now have webgen complain: ERROR -- No link target specified for link type ''alternate'' in ''link'' meta information in </notes/index.en.html> and so on? from reading the code it seems that the href is not found in the metainfo, but here''s what I have: link: alternate: - type: application/atom+xml href: /notes/feed.atom title: Posts (Atom) - type: application/rss+xml href: /notes/feed.rss title: Posts (RSS) On Tue, Feb 9, 2010 at 17:04, Damien Pollet <damien.pollet at gmail.com> wrote:> On Mon, Feb 8, 2010 at 21:20, Thomas Leitner <t_leitner at gmx.at> wrote: >>> The problem is, if webgen translates those to absolute links in the >>> html, it won''t work. I''m deploying the webgen output in a subtree of >>> the complete site, and I have a test deployment on a local web server >>> that does not have the same prefix. >> >> webgen translates internal paths *always* to relative paths! So it does >> not matter where you deploy your site, it will work everywhere. >> However, if you want absolute paths, it is also possible with a little >> patching (there was a mail exchange about this some time ago). > > No, relative is what I want. I just wasn''t sure it would do that everywhere. > Actually the problem might be that I have a separate template file for > the blog posts, and maybe the blog generator does not propagate all > its metainfo. I didn''t take the time to look in detail, links on the > main page are perfectly ok for the moment. > > > -- > Damien Pollet > type less, do more [ | ] http://people.untyped.org/damien.pollet >-- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-23 06:09 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Mon, 22 Feb 2010 17:10:46 +0100, Damien Pollet wrote:> Back on this? > I now have webgen complain: > > ERROR -- No link target specified for link type ''alternate'' in ''link'' > meta information in </notes/index.en.html> > > and so on? from reading the code it seems that the href is not found > in the metainfo, but here''s what I have: > > link: > alternate: > - type: application/atom+xml > href: /notes/feed.atom > title: Posts (Atom) > - type: application/rss+xml > href: /notes/feed.rss > title: Posts (RSS)This is a bug in the content processor head which I have fixed in my repo. -- Thomas
Damien Pollet
2010-Feb-25 12:38 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Tue, Feb 23, 2010 at 07:09, Thomas Leitner <t_leitner at gmx.at> wrote:> This is a bug in the content processor head which I have fixed in my > repo.Is it pushed to github ? -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-26 12:04 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Thu, 25 Feb 2010 13:38:58 +0100, Damien Pollet wrote:> On Tue, Feb 23, 2010 at 07:09, Thomas Leitner <t_leitner at gmx.at> > wrote: > > This is a bug in the content processor head which I have fixed in my > > repo. > > Is it pushed to github ?It now is. -- Thomas
Damien Pollet
2010-Feb-26 12:41 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Fri, Feb 26, 2010 at 13:04, Thomas Leitner <t_leitner at gmx.at> wrote:>> Is it pushed to github ? > > It now is.OK, I pulled that? - at first I got a bunch of errors due to mis-initialization of the metainfo tag? switched from require to load in ex/init.rb and that fixed those. - everything looks nice, the link#targets work, the feed metadata too, but? ?some pieces of markdown code appear as-is in the output, e.g. the tagline with my affiliation in the page headers, the title of entries in the main blog page, and the <img> tag in the blog post pages. The <img> tag problem was fixed by removing indentation (it was recognized as a markdown code block). The tagline looks more like the metainfo tag escapes ?or does not process its output like the include_file tag can. -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Damien Pollet
2010-Feb-26 13:02 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
On Fri, Feb 26, 2010 at 13:41, Damien Pollet <damien.pollet at gmail.com> wrote:> but?And in_menu: false is ignored (for at least one of the subdirectories) -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
Thomas Leitner
2010-Feb-26 14:14 UTC
[webgen-users] Adding custom <link>s to the <head> via the contentprocessor head
> ?some pieces of markdown code appear as-is in the output, e.g. the > tagline with my affiliation in the page headers, the title of entries > in the main blog page, and the <img> tag in the blog post pages.This is due to a change in the meta info tag. The meta info values are assumed to be output format agnostic. Therefore I added automatic escaping of meta info values inserted by the metainfo tag. I have added an option for disabling the escaping. The Github repo has been updated. -- Thomas