XHTML simple little header questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Haines Brown

    XHTML simple little header questions


    Re. <title>, my impression has been that a line break is _NOT_ allowed
    in the contained text. Is that true? Also, I gather a double quotation
    mark in the text string (and ampersand, etc.) _IS_ acceptable, but not
    char entities (such as &quote;), decimal characters (such as ‛)
    or style-sheet defined elements (such as <q>).

    Re. <meta name="descripti on">, is a line break acceptable here? My
    impression is that for the enclosed descriptor string, one can't have
    illicit characters (such as & and ") nor style-sheet defined elements
    (such as <q>, etc.), but only decimal characters in lieu of illicit
    characters (such as ‛).

    Re. <meta name="keywords" >, same question about line breaks. For
    XHTML, can one still freely choose either a comma-separated or
    space-separated list? Is there any reason to choose one over the
    other?

    --
    Haines Brown
    brownh@hartford-hwp.com
    kb1grm@arrl.net


  • Jukka K. Korpela

    #2
    Re: XHTML simple little header questions

    Haines Brown <brownh@teufel. hartford-hwp.com> wrote:
    [color=blue]
    > Re. <title>, my impression has been that a line break is _NOT_
    > allowed in the contained text. Is that true?[/color]

    No, in element content, a line break is always permitted. It is
    equivalent to a space (except within a <pre> or <textarea> element).
    [color=blue]
    > Also, I gather a
    > double quotation mark in the text string (and ampersand, etc.) _IS_
    > acceptable, but not char entities (such as &quote;), decimal
    > characters (such as ‛) or style-sheet defined elements (such
    > as <q>).[/color]

    The content model of <title> is #PCDATA, parsed character data, which
    means that any characters are allowed and entity references (such as
    &quot; - note the spelling, &quote; is undefined) and character
    references (such as ‛) are allowed, but no elements (such as
    <q>) are allowed. The quotation mark " is no problem, whereas the
    ampersand & can be, so it is safest to escape it as &amp; unless it is
    meant to start an entity or character reference.

    However, browsers get this partly wrong. For example, IE 6 on Win98
    seems to get ‛ very wrong. I had noticed that it displays –
    as a thick vertical bar (effectively as a symbol of undisplayable
    character) but with ‛ things get _very_ wrong: if I have
    <title>test ‛</title>
    then IE ignores the entire <title> element and displays the page's URL
    in the browser window's top bar where it normally shows the title.

    On ISO-8859-1 encoded pages, ISO-8859-1 characters work well in the
    <title> element, though. (Well, apart from the fact that the font used
    by the browser there is somewhat inadequate.)
    [color=blue]
    > Re. <meta name="descripti on">, is a line break acceptable here?[/color]

    You mean in the content attribute? That's partly a different thing. In
    principle, line breaks are permitted in attribute values and are
    equivalent to spaces. In practice, browsers sometimes get this wrong,
    and the XHTML 1.0 recommendation says, in the (in)famous appendix C:
    "Avoid line breaks and multiple white space characters within attribute
    values. These are handled inconsistently by user agents."
    As far as I know, this has nothing special to do with XHTML. Rather, it
    is based on an observation of browser behavior, which is indeed
    inconsistent. But this should be of little importance, since you mainly
    write those <meta> tags for search engines, not browsers, and I think
    search engines get this simple thing right.

    On the other hand, <meta name="descripti on"> is not particularly
    important. It is more important to start the _body_ of your document in
    an interesting way - in a way that makes human readers immediately
    interested and aware of the content and thereby gives good food to
    search engines as well.

    However, if, for example, a Mozilla user hits control-I on your page,
    to view page info, he will see, under the "Meta" heading, a
    "descriptio n" field. And there the line breaks seem to appear as double
    vertical bars - at least on Mozilla 1.4 under Win98. This is somewhat
    annoying, so it is best to write the description on one line if you can
    afford it (that is, if your authoring tool lets you work conveniently
    with long lines).
    [color=blue]
    > My
    > impression is that for the enclosed descriptor string, one can't
    > have illicit characters (such as & and ") nor style-sheet defined
    > elements (such as <q>, etc.), but only decimal characters in lieu
    > of illicit characters (such as ‛).[/color]

    The content attribute of <meta> is declared as being of type CDATA,
    which means (for attributes) effectively the same as #PCDATA. Thus,
    entity and character references are OK. Tags are not recognized (but
    neither are they errors - this deviates from #PCDATA, but we're getting
    rather theoretical here). The quotation mark " is a special case, since
    it is used as a delimiter, so inside the attribute value, it needs to
    be escaped e.g. as &quot; (if you use " as delimiter - you could use
    the apostrophe ' as well). Whether search engines get everything right
    is a different matter.
    [color=blue]
    > Re. <meta name="keywords" >, same question about line breaks.[/color]

    Ditto. But this <meta> tag is rather useless, since search engines have
    largely ignored it for years, due to widespread abuse.
    [color=blue]
    > For
    > XHTML, can one still freely choose either a comma-separated or
    > space-separated list? Is there any reason to choose one over the
    > other?[/color]

    Inside the content attribute in <meta name="keywords" content="...">,
    you mean? This is not defined in any specification. There are various
    rumors of what search engines actually do, but what sounds most
    probable is that commas separate words and phrases, whereas spaces just
    separate words _inside_ a phrase. So
    content="foo, bar zap, zip zop"
    would specify keywords/keyphrases "foo", "bar zap", "zip zop", and this
    might be relevant when people use phrase search. But this is just an
    educated guess, or maybe just speculation.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

    Comment

    • Haines Brown

      #3
      Re: XHTML simple little header questions

      "Jukka K. Korpela" <jkorpela@cs.tu t.fi> writes:
      [color=blue]
      > Haines Brown <brownh@teufel. hartford-hwp.com> wrote:
      >[color=green]
      > > Re. <title>, my impression has been that a line break is _NOT_
      > > allowed in the contained text. Is that true?[/color]
      >
      > No, in element content, a line break is always permitted. It is
      > equivalent to a space (except within a <pre> or <textarea> element).[/color]
      ....

      Thank you very much; you straightened out a number of points.

      --
      Haines Brown
      brownh@hartford-hwp.com
      kb1grm@arrl.net


      Comment

      • Alan J. Flavell

        #4
        Re: XHTML simple little header questions

        On Mon, 5 Jan 2004, Jukka K. Korpela wrote:
        [color=blue]
        > However, browsers get this partly wrong.[/color]

        Title bars are typically produced by facilities of the OS and/or the
        window manager, so it could be that the browser itself is not at
        fault (sometimes it is, sometimes it isn't).
        [color=blue]
        > For example, IE 6 on Win98
        > seems to get ‛ very wrong. I had noticed that it displays –
        > as a thick vertical bar (effectively as a symbol of undisplayable
        > character)[/color]

        I can't speak for Win98 specifically, but I was following some advice
        of yours when I found one solution to that class of problem: see

        (search for your own name).
        [color=blue]
        > but with ‛ things get _very_ wrong: if I have
        > <title>test ‛</title>
        > then IE ignores the entire <title> element and displays the page's URL
        > in the browser window's top bar where it normally shows the title.[/color]

        Bizarre.

        Comment

        • Stephen Poley

          #5
          Re: XHTML simple little header questions

          On Mon, 5 Jan 2004 19:34:16 +0000 (UTC), "Jukka K. Korpela"
          <jkorpela@cs.tu t.fi> wrote:
          [color=blue]
          >On the other hand, <meta name="descripti on"> is not particularly
          >important. It is more important to start the _body_ of your document in
          >an interesting way - in a way that makes human readers immediately
          >interested and aware of the content and thereby gives good food to
          >search engines as well.[/color]

          Generally true, I think, but I did come across one Dutch search engine
          recently whose help pages said (or at least implied) that it would only
          index pages with a <meta name="descripti on">.

          --
          Stephen Poley


          Comment

          • Jukka K. Korpela

            #6
            Re: XHTML simple little header questions

            Stephen Poley <sbpoleySpicedH amTrap@xs4all.n l> wrote:
            [color=blue]
            > I did come across one Dutch search engine
            > recently whose help pages said (or at least implied) that it would
            > only index pages with a <meta name="descripti on">.[/color]

            Luckily there is a rich supply of search engines, so that we can ignore
            such search engines that have no chances of getting much importance.
            A search engine that decides to restrict searches to a small minority
            of pages is hardly a successful effort.

            --
            Yucca, http://www.cs.tut.fi/~jkorpela/
            Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

            Comment

            Working...