Oturum açın

Creating Subscribed Links Using Text Files or Web Feeds

The Getting Started with a Dynamic Subscribed Link page introduced you to dynamic subscribed links, discussed the different formats you can use to create custom results, and suggested best practices. This page shows you how you can create a simple dynamic subscribed link using text files or web feeds. The section on web feeds assumes that you are already familiar with RSS 2.0 feeds.

Contents

This page includes the following sections:

Creating Results with TSV Text Files

If you don't need any of the more advanced features offered by the XML format and you don't have web feeds, you can create your subscribed link using a text file with tab-separated values (TSV). Use a plain text editor or a spreadsheet editor to create the file. It does not matter what you name the file, so long as you save it with the file extension: .tsv (for example, results.tsv). Make sure that the size of your files does not exceed the limit described in the Publishing Your Subscribed Link page.

Elements of a TSV Subscribed Link

Your TSV files should always begin with a header that has the following:

  • The first line of the file must be: # subscribed links TSV file.
  • The second line should specify the author of the subscribed link. It should start with the keyword author followed by the name of the person who created the file.

After you have defined the header, you can start creating your query and custom results. Create one query-result pair for each line. Each line should have the following elements in the same order as the list below:

  • Keyword: item - identifies the line as a query-result pair.
  • Query - the search term that will trigger the search result. Capitalization does not matter. Any form of capitalization of your query will trigger your search result. For example, the search queries, "Shuttlecock", "shuttlecock", and "ShuttleCock" are treated alike.
  • Title link - the URL for the title of your custom results. The URL that you specify creates a hyperlink for the title of your subscribed link results, and the URL itself appears at the bottom your custom results. The actual title for your custom result is defined last (see the last item in this list).
  • Result body - the descriptive body of text, which can have up to 240 characters.
  • Optional. Title text - the text of the title that appears at the top of your custom result. The title can have up to 50 characters. The title is a hyperlink, and the URL of result title is defined by the title link. If you do not specify a title, Google will automatically use the author name you defined in the header and the text of the query.

If you are using a plain text editor, separate each element by a single tab character. Do not try to prettify and align the lines of the file with multiple tab characters. If you are using a spreadsheet editor, allocate a column for each of the five elements. Follow the capitalization specified in the documentation; otherwise, the Developer Console will give you error messages.

TSV Example: Code

Let's look at an example of a TSV file:

# subscribed links TSV file
author Joe Author
item	hello world	www.google.com/coop	Hello, world! This is a test.
item	hello again	www.google.com/coop/directory	Hello again! This is another test. It is much much much much much much longer than the first test. Second test   

This subscribed link TSV file starts with the required header elements:

# subscribed links TSV file
author Joe Author

The header is followed by two items that include the required elements:

item	hello world	www.google.com/coop  Hello, world! This is a test.
item	hello again	www.google.com/coop/directory  Hello again! This is another test. It is much much much much much much longer than the first test. Second test

The first item includes only the required elements, which are: the keyword (item), the query (hello world), the title link (www.google.com/coop), and the result body (Hello World! This is a test.). Because the title text has not been specified, Google will use the author name and the query as the title text. In this case, the title would be "Joe Author-- hello world" and it would link to the URL that was defined as www.google.com/coop.

The second item includes all the required elements and the optional title text element (Second test).

TSV Example: Preview

Now, we submit the file to Google so that we can preview the subscribed link. After Google accepts the file, you can type the queries in the Google search box. When we type the query hello world, which was the first item that we specified in the TSV file, we see the following:

 

Note the title text of the subscribed link results.

Let's try the second query and type hello again in the Google search box. This time, we see the following.

Another example of a custom result created with a TSV file

Creating Results with Web Feeds

If you have RSS 2.0 web feeds for your website, you do not need to recreate a large amount of content for your custom results. You can show excerpts of your web content in your custom results simply by augmenting your existing web feeds with Subscribed Links tags. Make sure that the size of your files does not exceed the limit described in the Publishing Your Subscribed Link page.

Subscribed Links Tags for Web Feeds

To create a subscribed link, you need to apply the following to your web feed:

  • The Subscribed Links namespace: xmlns:coop="http://www.google.com/coop/namespace". It should be added in the beginning of the file, inside the <rss version="2.0"> label.

    Original Web Feed Web Feed Augmented with Subscribed Links Tags
    <?xml version="1.0"?>
    <rss version="2.0">
    <?xml version="1.0"?>
    <rss version="2.0" xmlns:coop="http://www.google.com/coop/namespace">


  • Query tags: <coop:keyword></coop:keyword>. The tags let you specify the triggering queries. Place these tags within each item element that you want to be displayed as a custom result. You can create multiple queries for an item on your web feed. Each query term should have its own set of coop:keyword tags; that is, you cannot have a series of query terms nestled inside the same pair of coop:keyword tags.

    In the following sample code, we specify three triggering queries: RSS support, Atom support, and Subscribed Links RSS. Any form of capitalization of the queries will trigger the search result. For example, the search queries, "RSS support", "rss support ", and "rss Support" are treated alike.

    Original Web Feed Web Feed Augmented with Subscribed Links Tags
    <item>
    						  
      <author>Ada Bogart</author>
      <title>New: RSS/Atom Support</title>
      <link>http://www.google.com/coop/docs/rss_atom.html</link>
    
      <description>
      Many of you have asked for an easier way to create 
      subscribed link from your existing RSS/Atom feeds. Now you 
      can just enter the URL of your RSS/Atom feed as a subscribed link 
      feed URL at http://www.google.com/coop/manage/subscribedlinks, 
      and we'll automatically create a simple subscribed link based on 
      that feed which provides links to and excerpts from recent 
      items posted to the feed. 
      </description>
    	
    </item>
    <item>
    
      <author>Ada Bogart</author>
      <coop:keyword>RSS support</coop:keyword>
      <coop:keyword>Atom support</coop:keyword>
      <coop:keyword>Subscribed Links RSS</coop:keyword>
      <title>New: RSS/Atom Support</title>
      <link>http://www.google.com/coop/docs/rss_atom.html</link>
    
      <description>
      Many of you have asked for an easier way to create 
      subscribed link from your existing RSS/Atom feeds. Now you 
      can just enter the URL of your RSS/Atom feed as a subscribed link 
      feed URL at http://www.google.com/coop/manage/subscribedlinks, 
      and we'll automatically create a simple subscribed link based on 
      that feed which provides links to and excerpts from recent 
      items posted to the feed. 
      </description>
    	
    </item>

Web Feed Example: Code

Let's take a look at the code of a short web feed before and after it has been augmented by Subscribed Links tags. The sample code has the following specified queries for each item in the web feed:

  • First item: RSS support, Atom support, and Subscribed Links RSS
  • Second item: Subscribed Links Directory
  • Third item: Subscribed Links Guide

In the sample code for the augmented web feed, you will note that we've added the following:

  • The Subscribed Links namespace, xmlns:coop="http://www.google.com/coop/namespace", to the top-level web feed tag.
  • coop:keyword tags for each query that will trigger Google to display an excerpt from that web feed item.
Original Web Feed Web Feed Augmented with Subscribed Links Tags
<?xml version="1.0"?>

<rss version="2.0">

  <channel>
    <title>Google Sample Channel</title>
    <link>http://www.google.com/coop</link>
    <description>Enhance Your Search</description>

    <item>
      <author>Google</author>
      <title>New: RSS/Atom Support</title>
      <link>http://www.google.com/coop/docs/tsv_webfeeds.html</link>

      <description>
      Many of you have asked for an easier way to 
      create a subscribed link from your existing RSS/Atom feeds. 
      Now you can just enter the URL of your RSS/Atom feed as a 
      subscribed links feed URL to Google, 
      and we'll automatically create a simple subscribed link 
      based on that feed which provides links to, and excerpts from, 
      recent items posted to the feed. There's just one catch: you 
      need to tell us which queries should trigger each item in 
      your feed.
      </description>
    </item>
	
    <item>
      <author>Google</author>
      <title>Providers in our Directory</title>
      <link>http://www.google.com/coop/directory</link>

      <description>
      We have dozens of providers in categories 
      such as Lifestyle, News, and Information, and are always
      adding more.
      </description>
    </item>

    <item>
      <author>Google</author>
      <title>Guide for Developers</title>
      <link>http://www.google.com/coop/docs/index.html</link>
      
      <description>
      Learn more about how to create custom
      subscribed links.
      </description>
    </item>

  </channel>
</rss>
<?xml version="1.0"?>

<rss version="2.0" xmlns:coop="http://www.google.com/coop/namespace">

  <channel>
    <title>Google Sample Channel</title>
    <link>http://www.google.com/coop</link>
    <description>Enhance Your Search</description>

    <item>
      <author>Google</author>
      <coop:keyword>RSS support</coop:keyword>
      <coop:keyword>Atom support</coop:keyword>
      <coop:keyword>Subscribed Links RSS</coop:keyword>
      <title>New: RSS/Atom Support</title>
      <link>http://www.google.com/coop/docs/tsv_webfeeds.html</link>

      <description>
      Many of you have asked for an easier way to 
      create a subscribed link from your existing RSS/Atom feeds. 
      Now you can just enter the URL of your RSS/Atom feed as a 
      subscribed links feed URL to Google, 
      and we'll automatically create a simple subscribed link 
      based on that feed which provides links to, and excerpts from, 
      recent items posted to the feed. There's just one catch: you 
      need to tell us which queries should trigger each item in 
      your feed.
      </description>
    </item>

    <item>
      <author>Google</author>
      <coop:keyword>Subscribed Links Directory</coop:keyword>
      <title>Providers in our Directory</title>
      <link>http://www.google.com/coop/directory</link>
      
      <description>
      We have dozens of providers in categories 
      such as Lifestyle, News, and Information, and are always
      adding more.
      </description>
    </item>

    <item>
      <author>Google</author>
      <coop:keyword>Subscribed Links Guide</coop:keyword>
      <title>Guide for Developers</title>
      <link>http://www.google.com/coop/docs/index.html</link>
      
      <description>
      Learn more about how to create custom 
      subscribed links.
      </description>
    </item>

  </channel>
</rss>

Web Feed Example: Preview

When we preview the subscribed link with the search query, "rss support", we would see the following results.

Custom result created from an RSS Feed

This result is from this query specification in the first item of the web feed:

<item>
      <author>Google</author>
      <coop:keyword>RSS support</coop:keyword>
      <coop:keyword>Atom support</coop:keyword>
      <coop:keyword>Subscribed Links RSS</coop:keyword>
      <title>New: RSS/Atom Support</title>
      <link>http://www.google.com/coop/docs/tsv_webfeeds.html</link>

      <description>
	  	Many of you have asked for an easier way to 
		create a subscribed link from your existing RSS/Atom feeds. 
		Now you can just enter the URL of your RSS/Atom feed as a 
		subscribed links feed URL to Google, 
		and we'll automatically create a simple subscribed link 
		based on that feed which provides links to, and excerpts from, 
		recent items posted to the feed. There's just one catch: you 
		need to tell us which queries should trigger each item in 
		your feed.
      </description>
</item>

Let's preview the subscribed link with another search query, "subscribed links directory".

Custom result created from an RSS feeds example

This result is from this query specification in the second item of the web feed:

<item>
      <author>Google</author>
      <coop:keyword>Subscribed Links Directory</coop:keyword>
      <title>Providers in our Directory</title>
      <link>http://www.google.com/coop/directory</link>
      
	  <description>
	  	We have dozens of providers in categories 
	  	such as Lifestyle, News, and Information, and are always
	  	adding more.
	  </description>
</item>

Taking the Next Step

If subscribed link based on TSV files and web feeds do not meet your needs, you can look into using XML to create your subscribed link. But if subscribed link based on TSV files or web feeds do the job, you could start testing them in preparation for a public release.

 

< Back to Getting Started with a Dynamic Subscribed Link | Forward to Testing and Troubleshooting >