When you use drupal_add_link(), it adds an extra newline before passing the data to drupal_set_html_head(). The problem is that drupal_set_html_head() *also* adds a newline to each output. So if you use drupal_add_link(), you get output like:

<link href="http://mysql.drupal6dev.local/opensearch/node" title="mysql.drupal6dev.local node search" rel="search" type="application/opensearchdescription+xml" /> 
 
<link href="http://mysql.drupal6dev.local/opensearch/user" title="mysql.drupal6dev.local user search" rel="search" type="application/opensearchdescription+xml" /> 
 
<link href="http://mysql.drupal6dev.local/opensearch/advanced_help" title="mysql.drupal6dev.local advanced_help search" rel="search" type="application/opensearchdescription+xml" /> 
 
<link href="http://mysql.drupal6dev.local/opensearch/location" title="mysql.drupal6dev.local location search" rel="search" type="application/opensearchdescription+xml" /> 

Comments

dave reid’s picture

You can even see the result in the source code of drupal.org's frontpage:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
 <head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <!-- Note: does not validate. We would like it to, but that would mean reduced user experience for the majority of our visitors. --> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link rel="alternate" type="application/rss+xml" title="drupal.org RSS" href="http://drupal.org/node/feed" /> 
 
<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" /> 
  <title>drupal.org | Community plumbing</title> 
dave reid’s picture

Status: Active » Needs review
StatusFileSize
new625 bytes

One-line fix patch attached for review.

boombatower’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new589 bytes

Might as well change " to ' while we are there since no more \n.

dave reid’s picture

Good point. Thanks!

gábor hojtsy’s picture

Not applicable to D7?

dave reid’s picture

It's already been fixed in D7 otherwise I would have filed it there first. :)

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Great, thanks. Committed to Drupal 6.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.