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
_______________________________________________
webgen-users mailing list
webgen...@rubyforge.org
http://rubyforge.org/mailman/listinfo/webgen-users
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
I have pushed the needed changes for this functionality to github and
rubyforge. Comments/Suggestions et al are welcome!
-- Thomas
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
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
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
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
yay, 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
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
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
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
Is it pushed to github ?
--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet
It now is.
-- Thomas
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
And in_menu: false is ignored (for at least one of the subdirectories)
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