Template error: Method "siteUrl" for object "Craft\ConfigVariable" does not exist Method "siteUrl" for object "Craft\ConfigVariable" does not exist

{% for locale in otherLocales %}

    {# Is this an entry page? #}
       {% if entry is defined %}

         {# Find the current entry in the other locale #}
        {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}

        {# Make sure that it's actually localized to this locale #}
       {% if localeEntry.locale == locale %}

           {# Output a link to it #}
            &lt;link rel="alternate" hreflang="{{ locale }}" href="{{ craft.config.siteUrl[locale] ~ (localeEntry.uri != '__home__' ? localeEntry.uri) }}"&gt;
         {% endif %}

    {% else %}

        {# Just output the same path with the locale's base URL #}
        &lt;link rel="alternate" hreflang="{{ locale }}" href="{{ craft.config.siteUrl[locale] ~ craft.request.getPath() }}"&gt;
    {% endif %}
{% endfor %}
Did you configure siteUrl in general.php?

return array(
    // ...
    'siteUrl' =&gt; array(
        'en' =&gt; 'http://example.com/en/',
        'de' =&gt; 'http://example.com/de/',
    ),
);