Custom Layout - metadata in the head.

25 views
Skip to first unread message

JezC

unread,
Oct 31, 2013, 8:23:12 PM10/31/13
to hobo...@googlegroups.com
Hiya, a few years ago, there was a helpful post on a similar topic with some good stuff in it.

However, I want to do something a little different for my customisation, and I'm not sure what the right, Hobo-ey, way is.

I want to have the usual document start tags, and the title tag. Then I want a section that I don't think is described. I want to have control over Google, and Bing. I want a meta description, and a meta robots. Something like this:

<!DOCTYPE html> <html lang="en">
<head> <title>a title</title>
<meta name="description" content="blah blah blah" />
<meta name="robots" content="NOINDEX" />



This isn't, strictly, a custom-scripts extension to add into app/views/taglibs/rapid/page.dryml  And it isn't a stylesheet. Nor is it a title. There's only those three classes of stuff in the head, isn't there?

Should I be defining a new page structure that includes a metadata section that I can then override? 

Do I abuse the scripts section to shove in things that aren't scripts? 

And what if I wanted to put in the zillion links that provides iPhone and iPad images, etc? There's no head section for images/links.

I have a vague feeling of dread that stuffing these "wrong" resources into the wrong section will likely break some other assumption. Such as that everything in the scripts section is, in fact, a script, for example.

I will be wanting to change the values in different parts of the app. Some pages will allow indexing, others will deny it. 

Even worse... I have, I think, a reason to want to embed canonical link references. But there's no section defined for links (favicon, as in the original post from 2009), prev/next, canonical, etc. Is the right way to handle these, still to abuse the intent behind the existing sections, too?

What's the right way to insert these elements? 

Ignacio Huerta

unread,
Nov 1, 2013, 3:14:36 PM11/1/13
to hobo...@googlegroups.com
Hi!

First of all, good question!

>From the HTML perspective, it doesn't matter the order of the elements
in the head, so you are not going to have any trouble in the future. But
from a coding perspective, finding the most elegant solution is always
very important :). A few options:

- <append-head:>. This would be the nicest solution. You add code before
the end of head.

- <after-scripts:> or <after-stylesheets:> You add code after these
elements, so it's not too bad.

- You redefine <page> completely. Just copy it whole from here
http://hobocentral.net/tagdef/hobo_clean/hobo_clean/page and customise
what you need. This might be the best option if you add more "param"
attributes so you can enable/customise them in other pages of the
application.

Regards,
Ignacio


El 01/11/13 01:23, JezC escribi�:
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre

Bryan Larsen

unread,
Nov 1, 2013, 3:31:20 PM11/1/13
to Hobo Users
On Fri, Nov 1, 2013 at 3:14 PM, Ignacio Huerta <ign...@ihuerta.net> wrote:

- You redefine <page> completely. Just copy it whole from here
http://hobocentral.net/tagdef/hobo_clean/hobo_clean/page and customise
what you need. This might be the best option if you add more "param"
attributes so you can enable/customise them in other pages of the
application.

And if you do find a few more useful places to add param statements, send in a pull request -- they're probably useful to others, too!

bryan
 

Jeremy Chatfield

unread,
Nov 1, 2013, 3:46:02 PM11/1/13
to hobo...@googlegroups.com
I like the idea of redefining <page>. One of the things I'd like to do, is to support Tag Managers. Things like Google Tag Manager want a Data Layer defined before it is used. So if I create a Data Layer entity, I can then make sure I've stuffed it properly, before I then fire up the Tag Manager later in the code.

And parameterising the page sounds perfect. If any page has a meta description, I want to have it indexed, so I could conditionally state "if a meta description has been provided, then INDEX, else NOINDEX". That feels elegant and reduces effort.

And similarly if I provide a canonical link reference, I'll want to use that to override a default that would be the current page URL.

Yeah, that seems like the right way to do it. 

Thanks for the advice and link!




On Fri, Nov 1, 2013 at 7:14 PM, Ignacio Huerta <ign...@ihuerta.net> wrote:
Hi!

First of all, good question!

>From the HTML perspective, it doesn't matter the order of the elements
in the head, so you are not going to have any trouble in the future. But
from a coding perspective, finding the most elegant solution is always
very important :). A few options:

- <append-head:>. This would be the nicest solution. You add code before
the end of head.

- <after-scripts:> or <after-stylesheets:> You add code after these
elements, so it's not too bad.

- You redefine <page> completely. Just copy it whole from here
http://hobocentral.net/tagdef/hobo_clean/hobo_clean/page and customise
what you need. This might be the best option if you add more "param"
attributes so you can enable/customise them in other pages of the
application.

Regards,
Ignacio


El 01/11/13 01:23, JezC escribió:
Teléfono: 0034 645 70 77 35

Email realizado con software libre

--
You received this message because you are subscribed to a topic in the Google Groups "Hobo Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hobousers/A8dBg5whdWw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hobousers+...@googlegroups.com.

To post to this group, send email to hobo...@googlegroups.com.
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jeremy Chatfield - 
Skype: jezchatfield, Mobile: +44(0)7780 607613

Jeremy Chatfield

unread,
Nov 6, 2013, 6:58:05 AM11/6/13
to hobo...@googlegroups.com
OK, I've had a bit of a play with this. I think that if I'm to override the <page> definition properly, I need to do so in this file in the main hobo gem:

lib/generators/hobo/front_controller/templates/index.dryml

Is that the right place to override? And that means that only new projects, pulled from that branch, would get the new page definitions. I can't patch these header changes into an existing project, without a gem update? Or creating a new supplementary gem, I suppose?

The vivid warning in the top of "app/views/taglibs/rapid/page.dryml" suggests that it will be overwritten by something, at some point (I'm not sure when, and what triggers it... but it's definitely not a good place to make real changes, I can see!)

I have to admit that I've not tried managing a project where I've branched a main gem maintained by someone else.... I'll probably have to do some digging into rvm and gem to understand how to pull a different branch off github.

TIA, JeremyC


Jeremy Chatfield

unread,
Nov 6, 2013, 7:38:29 AM11/6/13
to hobo...@googlegroups.com
Blast. That's not the right file. That's the generator for the default home page. Not the views/taglibs/rapid/page.dryml file.

Looks like it is "hobo_bootstrap-2.0.1/taglibs" and the page.dryml, there?

Cheers, JeremyC.

Ignacio Huerta

unread,
Nov 6, 2013, 8:41:26 AM11/6/13
to hobo...@googlegroups.com
Hi Jeremy,

That's probably the page.dryml that you want to override. I don't think
you need your own branch/gem for this customisation to work.

What happens if you copy the contents of page.dryml and paste them into
front_site.dryml?

Regards,
Ignacio

El 06/11/13 13:38, Jeremy Chatfield escribi�:
> El 01/11/13 01:23, JezC escribi�:
> <mailto:hobousers%2Bunsu...@googlegroups.com>.
> > To post to this group, send email to
> hobo...@googlegroups.com <mailto:hobo...@googlegroups.com>.
> > Visit this group at http://groups.google.com/group/hobousers.
> > For more options, visit
> https://groups.google.com/groups/opt_out.
>
> --
> Ignacio Huerta Arteche
> http://www.ihuerta.net
> Tel�fono: 0034 645 70 77 35 <tel:0034%20645%2070%2077%2035>
> Email realizado con software libre
>
> --
> You received this message because you are subscribed to a
> topic in the Google Groups "Hobo Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/hobousers/A8dBg5whdWw/unsubscribe.
> To unsubscribe from this group and all its topics, send an
> email to hobousers+...@googlegroups.com
> <mailto:hobousers%2Bunsu...@googlegroups.com>.
> To post to this group, send email to
> hobo...@googlegroups.com <mailto:hobo...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit
> https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> Jeremy Chatfield -
> Skype: jezchatfield, Mobile: +44(0)7780 607613
> <tel:%2B44%280%297780%20607613>
>
>
>
>
> --
> Jeremy Chatfield -
> Skype: jezchatfield, Mobile: +44(0)7780 607613
> <tel:%2B44%280%297780%20607613>
>
>
>
>
> --
> Jeremy Chatfield -
> Skype: jezchatfield, Mobile: +44(0)7780 607613
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35

kevinpfromnm

unread,
Nov 6, 2013, 2:14:00 PM11/6/13
to hobo...@googlegroups.com
The page tag definition will be in the theme taglib yes.

Out of curiosity, is there some reason you're grabbing the whole thing to redefine?  I haven't found any case yet where the default parameters available on the page tag were not sufficient to be able to modify it to my needs via the various DRYML manipulation methods (before, after, prepend, append and replace).

Jeremy Chatfield

unread,
Nov 6, 2013, 3:26:11 PM11/6/13
to hobo...@googlegroups.com
Hi, most awesome and puissant kevinpfromnm! Two main reasons... and a flotilla of less ones.

I asked what the right way was... and extending the <page> definition to create entities other than scripts, or stylesheets, seemed right. It felt that there should be named sections for links, and metadata. They're pretty important components in my world (search engine and social media presentation). Relegating them to "oh, just stick in 'em in somewhere the head", seemed curiously insensitive to their importance in helping users to find the right data on the right website. :)

And... I don't know Hobo that well. I only code infrequently, these days. This seemed like a reasonable way to start working out how Hobo really works, so that I could drop in some stuff that I do understand. 

That's why I asked for advice ;)

Cheers, JeremyC.
 
Reply all
Reply to author
Forward
0 new messages