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.
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
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.
On 29/08/06, Nathan W. [email protected] wrote:
Let me know and I’ll see if I can
work up a diff for you.
I’d also be interested in this 
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;’ %>
Hope that helps!
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:inedit’
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 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.
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.
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:
I got it working using the original files from the mail list.
Thanks,
Bryan