Difference between revisions of "How to change the title of the home page"

From Spiffy Stores Knowledge Base

m (Created page with 'The home page has a default title of 'Welcome'. If you want to change this, you will need to make a simple change to your Theme.liquid file. Edit your Theme.liquid file and you…')
 
m
Line 35: Line 35:
 
     {{ header.description }}
 
     {{ header.description }}
 
     {{ header.keywords }}
 
     {{ header.keywords }}
     {% if template == 'index' %}{% assign page_title = 'This is my index page' %}{% endif %}
+
     {% if template == 'index' %}{% assign page_title = 'This is my custom home page title' %}{% endif %}
 
     <title>{{page_title}} &mdash; {{shop.name}}</title>
 
     <title>{{page_title}} &mdash; {{shop.name}}</title>
 
     ...
 
     ...
 
</pre>
 
</pre>

Revision as of 10:06, 27 January 2011

The home page has a default title of 'Welcome'.

If you want to change this, you will need to make a simple change to your Theme.liquid file.

Edit your Theme.liquid file and you will probably see something like this at the start of the file:

<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    {{ header.author }}
    {{ header.copyright }}
    {{ header.description }}
    {{ header.keywords }}
    <title>{{page_title}} — {{shop.name}}</title>
    ...

To add a custom home page title, you just need to add the following line just above the <title> tag.

{% if template == 'index' %}{% assign page_title = 'This is my custom home page title' %}{% endif %}

Change the title text to whatever you want and then insert the line as follows:

<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    {{ header.author }}
    {{ header.copyright }}
    {{ header.description }}
    {{ header.keywords }}
    {% if template == 'index' %}{% assign page_title = 'This is my custom home page title' %}{% endif %}
    <title>{{page_title}} — {{shop.name}}</title>
    ...