You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by gu...@switchonline.com.au on 2002/03/19 05:37:14 UTC

Re: Adding *Page Specific* Title , Keywords and Description Meta Tags in EmbperlObject Pages?

On Tue, Mar 19, 2002 at 09:57:01AM +0530, Rajesh Kumar Mallah wrote:
> I  have a website that is template driven and i use EmbperlObject for that.
> The problem is that all the pages share the same template (that is of course
> expected!)
> and they also share the  <title/>  ,  <meta name="..."  content="..." /> tags
> also.
> the latter is expected of EmbperlObject  but is  causing problem in my website.
> 
> One would suggest  I  put a meta.html file in each folder where i want the
> override
> the template defaults.
>  
> 
> But my problem is that under the same folder i require different META , TITLE
> tags
> for different files!  and if a put a meta.html in one folder all the files in
> that folder
> have the same meta tags that does not solve my problem ..

in a random .html:

[! sub title { 'Page title' }
   sub meta { (description => 'A random page', keywords => 'key1, key2, etc') }
 !]

in wherever you do the <head> tag:

<head>
 [- $req = shift; %meta = $req->meta -]
 <title>[+ $req->title +]</title>
 [$ foreach $k keys(%meta) $]
 <meta name="[+ $k +]" content="[+ $meta{$k} +]">
 [$ endforeach $]
</head>


See the section called "Example for using method calls" in the
HTML::EmbperlObject manpage.

-- 
 - Gus

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org