On 2009-11-14 Tim Williams <william...@gmail.com> said: > On Sat, Nov 14, 2009 at 7:38 AM, Vicent Mas <uve...@gmail.com> wrote: > > On 2009-11-13 Vicent Mas <uve...@gmail.com> said: > >> Hi all, > >> > >> I'm trying to fine tunning my dispatcher website. One thing that I find > >> particularly annoying is the fact that regular processing of a xdoc > >> fragment like: > >> > >> <document id="mydoc_id"> > >> > >> <header> > >> <title>My title</title> > >> </header> > >> <body> > >> ... > >> > >> will produce an HTML page like: > >> > >> <html> > >> <head> > >> <title>My title</title> > >> </head> > >> <body> > >> <div id="content"> > >> <h1 class="content-title">My title</h1> > >> ... > >> > >> so the *same* title will appear in the title bar of the browser window > >> and in the body of the html page. In addition, this title is used for > >> search engines like google when the result of a search is shown. But the > >> body title string normally is not meaningful when displayed as a result > >> of a search or when displayed in the title bar of the web browser. So > >> I'd like to know how to specify different titles for the HTML head and > >> the HTML body. Is ther a direct way for doing it with Forrest? Or have I > >> to do some hacking? > >> > >> Thanks in advance. > >> > >> Vicent > > > > Hi again, > > > > I've been playing around with contracts that seem related to the subject > > (namely content-title.ft and title.ft) but I cannot figure out how to do > > what I want in an easy way. > > > > Also I've found a new problem (although it doesn't affect me right now): > > the content-title.ft contract description says it deal with subtitles but > > I don't see the code for doing it. In fact I've not succeeded using > > subtitles in my xdocs: using a subtitle element inside a header element > > produces no output at all. > > > > Any ideas? Help will be appreciated. > > Hi Vincent, > I haven't poked around with dispatcher in a long time and don't > remember the preferred way of modifying contracts, but it looks like > your on the right track with the content-title contract. That > contract appears to output a title in two locations (the two > forrest:part elements), you're happy with one, but not the other. > > It's been a while, so this may not be correct, but you might try... >
Hi Tim, thanks for your reply. > o) Overriding the content-title contract in your local project, > removing the undesired output part. Overriding this contract is what I'm trying to do. As I said I want 2 different titles, head-title and body-title. Right now what I'm doing for specifying both titles in my xdoc sources is something like <head> <title id="body-title">head-title</title> </head> This is something dirty I know, but it is my only idea right now. My main problem is that I don't understand how content-title.ft works: <forrest:part xpath="/html/head"> <xsl:comment>+ |start content-title +</xsl:comment> <xsl:copy-of select="$content-title/*"/> <xsl:comment>+ |end content-title +</xsl:comment> </forrest:part> How does the contract get the value "$content-title/*"? If I replace this value for a string literal then the title element is not included in the head of the generated HTML file but in the body. Why? > o) Finding the right contract to override to output the title in a new > location (override that contract, find the right params to pass in, > etc.) > I don't understand what you mean. As I said what I want is 2 different titles. I'm happy with the current locations where titles appear in the generated HTML files. Vicent :: Share what you know, learn what you don't
signature.asc
Description: This is a digitally signed message part.