Refining Your Search Index with Swiftype Meta Tags
Note: For a video explanation of best practices for indexing with Swiftype, watch the recording of our dedicated customer success webinar.
This tutorial will teach you how to use Swiftype’s custom set of meta tags to control what our web crawler indexes as it moves through your website. It is divided into the following sections:
- What are Swiftype meta tags?
- Why are Swiftype meta tags useful?
- How are Swiftype meta tags formatted, and where do I place them on my page?
- What do Swiftype meta tags allow me to do?
1. What are Swiftype meta tags?
Much like Facebook and Google’s open graph meta tags, Swiftype meta tags are placed in the
<head> section of a web page and can contain information that is not rendered on the page. Swiftype meta tags speak directly to our web crawler and allow site owners to curate what fields and content comprise their website schema. While Google and Facebook have a set of acceptable meta tags that site owners can place on their site, Swiftype allows site owners to define their own meta tags on top of our default system fields (see below).
2. Why are Swiftype meta tags useful?
Swiftype meta tags allow you to control exactly how and what content gets indexed from your source code. By default, our web crawler will extract information from the following fields:
title(from the page’s
body(from the page’s content)
sections(from the page’s
While this default setting will extract all of the content from your webpage, creating meta tags allows our crawler to collect this information in a highly organized, structured format. For example, you may want to specify that a certain part of a product page is the “price” instead of just a miscellaneous number within the larger body of text. Once this information is collected in a more structured format, you will have the power to tightly control your relevance algorithm (see weights in section 4) and give users the power to easily refine their search results (see facets and filters in section 4).
3. Where do I format/place them in my website template?
- For this section, we are going to use our demo ecommerce store as an example (note that meta tags can be used across any type of website). Take a moment to look over the structure of the product page below:
- In this example, we’ll want to exclude the header, sidebar, and footer from being indexed, since these elements are not directly relevant to the featured product shown and reappear across every product page on the website. This can be done by using content exclusion/inclusion tags at the template level of your website (details here).
Now, with these exclusion/inclusion tags in place, the red highlighted sections above will not be indexed by the web crawler. This is beneficial because without excluding these elements, any search query that includes a term from these template sections will return every single product page as a result.
From here, we can now decide what fields we want to extract from the remaining sections. In the red outlined sections below we can see what information we want to focus on.
We’ve chosen to index the following attributes for each product (Note that we’ve chosen not to index quantity or add to cart, since these are only shopping options, not product features):
- product description
- product thumbnail
In addition to passing displayed product information to our web crawler, you can also create meta tags to pass our crawler information that doesn’t appear on the page (meta-data), such as sales statistics/popularity, whether or not the product is in stock, keywords, or anything else you want to use to impact search results.
After adding your customizations, and before recrawling, it's possible to view the impact of meta tags on your search engine index with the Live Index Preview tool. The Live Index Preview tool lets you compare the elements and content that Swiftype has already indexed to your engine side-by-side with the modifications currently on your site. To access this tool, visit the Detail view of a page under the Content section of your dashboard. Then, click on the bolt icon to switch to Live Index Preview mode.
- The Live Preview Tool provides a greater degree of flexibility when making site changes. It allows you to immediately see the impact of changes in your search engine without having to wait for a recrawl to take place. Furthermore, site owners can trigger immediate recrawls of specific pages, allowing them to exercise granular control over their site index if making small changes to their site.
4. What do Swiftype meta tags allow me to do?
Once your website is crawled with these custom meta tags in place, it's possible to fine tune your search results in the weights tab of your Swiftype dashboard.
In the column on the left, you’ll see your default fields included in dropdown menus and located just above slider bars indicating the “impact” that each field has on returned search results. At the bottom of this list you’ll find an option to add any additional or custom fields found in your engine schema to the overall factoring of the result score. Note that the default impact for custom fields is 1. You can test the output of different field weightings by entering a query in the search box on the right half of the frame and then adjust the desired sliders. As you re-adjust the weights, you will see the sample results re-order in real time.
FACETS AND FILTERS
Additionally, by creating meta tags to define specific attributes across your product set you’ll have the power to let site visitors...
- Change result sorting options (sort by relevance, price, name, rating, etc.)
- Sort results by specific attributes (price, color, size, etc.)
- Restrict search results to specific categories (men’s clothing, women’s clothing, etc.)
This type of navigation is referred to as faceted search. For an example of how each of these options works in our demo store, see the outlined red elements on the screenshots below. Then, for a detailed walkthrough on how to implement faceted search, you can visit our tutorial.