# Another question - Entering metadata

**URL:** <https://www.ruby-forum.com/t/another-question-entering-metadata/66809>\
**Category:** Radiant CMS\
**Created:** [August 29, 2006, 2:53pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809 "2006-08-29T14:53:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [August 29, 2006, 2:53pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/1 "2006-08-29T14:53:14Z")

</div>

Hi all,

Another question that Iâ??m sure people will want to do if theyâ??re  
creating  
commercial sites with Radiant:

When I click on the â??Moreâ? link on a standard edit page, I can change  
the  
slug and the breadcrumb. I would also like to enter a description and  
keywords â?? these would then get included into my header as metadata for  
the  
page â?? at the moment I have to just define the header for the whole site  
(or  
have multiple header snippets for site sections), but if I want to give  
myself every chance of being found on the search engines for the right  
things, I need to customize on a per-page level.

Anyone else want to do this? If people were interested, this could be  
an  
enhancement? If someone was prepared to point me in the right  
direction,  
Iâ??d have a go myself when I have the time.

(On a separate, more trivial note, it would be nice to have the â??Moreâ??  
expanded by default, to remind people to fill the boxes in â?? it would  
also  
be nice to make the boxes mandatory, so you canâ??t save a new page  
without  
them â?? otherwise authors are always going to forget at some point.)

Cheers,

Jake.

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [August 29, 2006, 3:05pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/2 "2006-08-29T15:05:15Z")

</div>

Jake,

You’re probably better off creating page parts for each of those  
metadata  
items, and then again using the \<r:content …/\> tag to insert their  
values  
into your template. The “more” link/dropdown is primarily for  
system-specific-and-critical stuff, whereas page metadata like keywords  
and  
descriptions are really content.

Sean C.  
[seancribbs.com](http://seancribbs.com)

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [August 29, 2006, 4:13pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/3 "2006-08-29T16:13:22Z")

</div>

I agree with Sean on this, but if you _really_ want to insert them  
into the “more” section it’s pretty easy to get this setup. I did it  
for a client when I thought the concept of adding page parts might be  
a little too difficult for them. Let me know and I’ll see if I can  
work up a diff for you.

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [August 29, 2006, 4:21pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/4 "2006-08-29T16:21:23Z")

</div>

On 29/08/06, Nathan W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Let me know and I’ll see if I can  
> work up a diff for you.

I’d also be interested in this 🙂

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [August 29, 2006, 11:18pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/5 "2006-08-29T23:18:51Z")

</div>

There’s really only 2 files that you need to change:  
script/setup\_database (or add the two new columns to your existing  
database) and app/views/admin/page/new.rhtml . See the attached files  
if you’re feeling lazy.

— script/setup\_database  
@@ -141,6 +141,8 @@  
t.column “created\_by”, :integer  
t.column “updated\_by”, :integer  
t.column “virtual”, :boolean, :default =\> false, :null =\>  
false

- 

```
     t.column "keywords", :text

```

- 

```
     t.column "description", :text
   end

```

— app/views/admin/page/new.rhtml  
@@ -75,6 +75,14 @@

Breadcrumb  
\<%= text\_field “page”, “breadcrumb”,  
:class =\> ‘textbox’, :maxlength =\> 160 %\>  

- 

```
   <tr>

```

- 

```
     <td><label for="page_keywords">Keywords</label></td>

```

- 

```
     <td class="field"><%= text_area "page", "keywords", :style

```

=\> ‘width: 100%; height: 5em;’ %\>

- 

```
   </tr>

```

- 

```
   <tr>

```

- 

```
     <td><label for="page_description">Description</label></td>

```

- 

```
     <td class="field"><%= text_area "page", "description",

```

:style =\> ‘width: 100%; height: 5em;’ %\>

- 

```
   </tr>
 </table>
 <script type="text/javascript">
 // <![CDATA[

```

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [September 1, 2006, 7:26am UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/6 "2006-09-01T07:26:16Z")

</div>

I received the following error when I made the changes suggested.

I am new to Ruby on Rails. Any ideas what is causing this?

Thanks,

Bryan

Using Radiant 0.5.2

Showing app/views/admin/page/new.rhtml where line #82 raised:

compile error  
script/…/config/…/app/views/admin/page/new.rhtml:82: parse error,  
unexpected tASSOC, expecting ‘)’  
=\> ‘width: 100%; height: 5em;’ ).to\_s); \_erbout.concat “\n”  
^  
Extracted source (around line #82):

79:

  
80: Keywords  
81: \<%= text\_area “page”, “keywords”, :style  
82: =\> ‘width: 100%; height: 5em;’ %\>  
83:   
84:   
85: Description  
Trace of template inclusion: /app/views/admin/page/new.rhtml

RAILS\_ROOT: script/…/config/…

Application Trace | Framework Trace | Full Trace  
#{RAILS\_ROOT}/app/views/admin/page/new.rhtml:176:in `compile_template' app/controllers/admin/page_controller.rb:30:in`edit’

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [September 1, 2006, 11:55am UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/7 "2006-09-01T11:55:44Z")

</div>

The style part should go in the options hash, so it should probably  
be like this:

\<%= text\_area “page”, “keywords”, { :style =\> “width: 100%; height:  
5em;’”} %\>

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [August 29, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/8 "2006-08-29T17:27:36Z")

</div>

I think you and Sean are right - but I’d be very interested in the diff  
anyway, just in case I need it in the future.

Thanks for the help.  
Jake.

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [September 4, 2006, 1:49pm UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/9 "2006-09-04T13:49:32Z")

</div>

Nathan W. wrote:

> I agree with Sean on this, but if you _really_ want to insert them  
> into the “more” section it’s pretty easy to get this setup. I did it  
> for a client when I thought the concept of adding page parts might be  
> a little too difficult for them. Let me know and I’ll see if I can  
> work up a diff for you.

I’ve also gone with this direction but have yet to put my app into  
production. Did you run into any issues doing it this way rather than  
page parts?

Again, the only fields added are keywords and tags. I think the tags  
field would be a lot more difficult to add as a page-part as it works  
directly with a tagging system and is used for multiple functions  
throughout the front and back-end areas of the app. The keywords aren’t  
used directly at the moment but will be once full-text searching has  
been implemented as a higher boost will be given to that field.

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [September 5, 2006, 12:28am UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/10 "2006-09-05T00:28:03Z")

</div>

jeroen janssen wrote:

> The style part should go in the options hash, so it should probably  
> be like this:
> 
> \<%= text\_area “page”, “keywords”, { :style =\> “width: 100%; height:  
> 5em;’”} %\>

I attempted to use the above code. I received the following compile  
error. I am I missing something basic with the code syntax?

Thanks,

Bryan

compile error  
script/…/config/…/app/views/admin/page/new.rhtml:81: odd number list  
for Hash  
script/…/config/…/app/views/admin/page/new.rhtml:82: parse error,  
unexpected tASSOC, expecting ‘}’  
=\> ‘width: 100%; height: 5em;’}).to\_s); \_erbout.concat “\n”  
^  
script/…/config/…/app/views/admin/page/new.rhtml:82: parse error,  
unexpected ‘}’, expecting ‘)’  
=\> ‘width: 100%; height: 5em;’}).to\_s); \_erbout.concat “\n”  
^  
Extracted source (around line #81):

78:   
79:

  
80: Keywords  
81: \<%= text\_area “page”, “keywords”, { :style  
82: =\> ‘width: 100%; height: 5em;’}%\>  
83:   
84:

---

<div class="post-metadata">

**Author:** ![Jake\_Liddell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@Jake\_Liddell](https://www.ruby-forum.com/u/Jake_Liddell)\
**Post date:** [September 5, 2006, 7:20am UTC](https://www.ruby-forum.com/t/another-question-entering-metadata/66809/11 "2006-09-05T07:20:51Z")

</div>

I got it working using the original files from the mail list.

Thanks,

Bryan
