pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
Philip Newton ([personal profile] pne) wrote in [community profile] style_system2010-10-15 03:45 pm

Add a meta tag to my journal

I’d like to add a <meta> tag to the HTML of my journal - that has to go inside the <head>...</head> section, so I guess I have to modify my style or create a layer or something.

http://www.dreamwidth.org/customize/options says I’m using “Cinnamon Cream” and “Crossroads by branchandroot” (I’m guessing the first is the colour scheme and the second is the style?).

Could someone help me accomplish this, please? Handholding would be appreciated since I’m really not a styles person.

Thank you in advance for any help you can provide!

foxfirefey: Fox stealing an egg. (mischief)

[personal profile] foxfirefey 2010-10-15 04:21 pm (UTC)(link)
Alright, so!

Crossroads is your layout layer. Cinnamon Cream is your theme layer. Go here:

http://www.dreamwidth.org/customize/advanced/layers

Create a new layout-specific layer: theme with Crossroads. Go here and copy the contents theme layer into your new theme layer:

http://www.dreamwidth.org/customize/advanced/layersource?id=82597

Take out this line:

layerinfo redist_uniq = "crossroads/cinnamoncream";


Now, at the end, add a function like this:

function Page::print_custom_head() {
    """META TAG GOES INSIDE THESE QUOTE MARKS""";
    """ANOTHER THING TO GO INTO YOUR HEAD YAY""";
}


Save and it should compile. Remember your ; though!
foxfirefey: A fox colored like flame over an ornately framed globe (Default)

[personal profile] foxfirefey 2010-10-16 06:20 pm (UTC)(link)
Hrm, no, that is not the problem--Crossroads inherits from Core2, where both print_head and print_custom_head are defined:

function Page::print_head() {
    print $.head_content;
    $this->print_custom_head();
}

function Page::print_custom_head() {
    # blank
}


So alas this is not working as it should I think, and it must be fixed! Now I'm wondering where the problem is. I don't think it's the cleaner...

Anyway, we're going to have to do what I hoped not to do: copy the function Page::print() function into the theme layer you are making and edit it instead. You should probably find the section of <head> inside all the printing and be able to add your tag there--this time I tested doing that and it worked something like:

    """
    >!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"<
    >html xmlns="http://www.w3.org/1999/xhtml"<
    >head<""";
        $this-<print_head();
        $this-<print_stylesheets();
        $this-<print_head_title(); 
        """>meta name="description" content="TESTING" /<""";
    println ">/head<";


WOE. And I will file a bug to try and figure out why that darned function that was supposed to work for cases like this is not!
Edited (oh noes HTML escaping) 2010-10-16 18:21 (UTC)
foxfirefey: A cat with a fish bowl on its head. (space cadet)

[personal profile] foxfirefey 2010-10-16 06:23 pm (UTC)(link)
oh lordy I mixed up my signs. BUT I THINK YOU CAN TELL WHAT I MEAN.
marahmarie: (M In M Forever) (Default)

[personal profile] marahmarie 2010-10-17 05:25 am (UTC)(link)
Not "just working" for me, don't know why. Compiled with no errors but did not show up in the page source. When I added it to already existing print custom head code (for my favicon) it broke my header CSS; when added as a second, separate function, the meta-ness did not show up in the source at all (though it did,like I said, compile).

I would like to add META tags, too...

BTW, my layer...

http://www.dreamwidth.org/customize/advanced/layersource?id=116552


False alarm, so it's working for me: I forgot to actually add meta tags (I just copied out your example text, duh). Sorted!

Edited (omg I'm an idiot) 2010-10-17 05:34 (UTC)
matgb: Artwork of 19th century upper class anarchist, text: MatGB (Default)

[personal profile] matgb 2010-10-16 06:44 pm (UTC)(link)
You've missed a step. Needs to create or edit a style and apply this theme layer instead of the default theme layer.

@Pne: go to Your Styles, the style you're using should be in bold. Click the edit tab, at the bottom there's a series of drop downs, for the 'theme' layer the default will be selected, but if you click it, the drop down will give you a list of all available, one of them (likely at the bottom) will be your new layer (remembering the layer number from the Layers page will help with that actually).

If it still doesn't work, then Fey's below comment might help.
matgb: Artwork of 19th century upper class anarchist, text: MatGB (Default)

[personal profile] matgb 2010-10-16 07:11 pm (UTC)(link)
De nada.

The scary thing is, I got somethign right and 'Fey missed it. That's really not supposed to happen...

Anyway, you have your MicroID working (I assume that's what you added), it's not actually something I've encountered before. Doubt it would be of much use to me, my email address is so public it's silly...
matgb: Artwork of 19th century upper class anarchist, text: MatGB (Default)

[personal profile] matgb 2010-10-16 07:22 pm (UTC)(link)
Heh, haven't logged into that site for years, appears my profile there is more'n a little out of date, don't own two of those domains anymore...
foxfirefey: A wee rat holds a paw to its mouth. Oh, the shock! (myword)

[personal profile] foxfirefey 2010-10-17 03:00 am (UTC)(link)
The shaaaaame!
foxfirefey: Look at this wee octopus! LOOK AT IT! (squee)

[personal profile] foxfirefey 2010-10-17 03:11 am (UTC)(link)
Okay, in penance I've made a cookbook recipe about the topic.