0

In a typical multisite D7 installation, I would like to set up apple touch icons. So that, when an agent requests http://example-1.com/apple-touch-icon.png then he receives the image appropriate for site example-1. And for site example-2, it should be a different image with the same name (and unfortunately at the exact same url, which is the multisite root directory). How can this be solved?

1

It doesn't totally help with the default paths, but I explicitly define them for each theme:

/**
 * Implements hook_preprocess_html().
 */
function MYTHEME_preprocess_html(&$variables) {
  $path = drupal_get_path('theme', 'MYTHEME');

  drupal_add_html_head(array(
    '#tag' => 'link',
    '#attributes' => array(
      'href' => $path . '/images/favicon.png',
      'rel' => 'icon',
      'type' => 'image/png'
    ),
  ), 'MYTHEME-favicon');

  drupal_add_html_head(array(
    '#tag' => 'link',
    '#attributes' => array(
      'href' => $path . '/images/touch-icon-iphone.png',
      'rel' => 'apple-touch-icon',
    ),
  ), 'MYTHEME-touch-icon-iphone');

  drupal_add_html_head(array(
    '#tag' => 'link',
    '#attributes' => array(
      'href' => $path . '/images/touch-icon-ipad.png',
      'sizes' => '72x72',
      'rel' => 'apple-touch-icon',
    ),
  ), 'MYTHEME-touch-icon-ipad');

  drupal_add_html_head(array(
    '#tag' => 'link',
    '#attributes' => array(
      'href' => $path . '/images/touch-icon-iphone-retina.png',
      'sizes' => '114x114',
      'rel' => 'apple-touch-icon',
    ),
  ), 'MYTHEME-touch-icon-iphone-retina');

  drupal_add_html_head(array(
    '#tag' => 'link',
    '#attributes' => array(
      'href' => $path . '/images/touch-icon-ipad-retina.png',
      'sizes' => '144x144',
      'rel' => 'apple-touch-icon',
    ),
  ), 'MYTHEME-touch-icon-ipad-retina');
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.