The good and the bad thing about the Internet is that it’s a 24/7 global resource. For many of us, however, the content we produce for the web is meant for a local audience.
Content written for a local audience can lead to some confusion as the audience for your website expands to a global audience.
Is that 7 pm your time or mine? 85 grams is how many ounces? What number do I need to dial to reach Hong Kong?
To overcome some of these challenges, developers have come up with a way to supplement or annotate content using additional bits of information called microdata or structured data. This additional information can then be used by search engines and browsers to identify and standardize the information contained within a web page.
Adding Microdata To Your Site
https://schema.org is the easiest place to go to get started with adding RDF microdata to your site.
On Schema.org’s site, there are samples for multiple styles:
- Microdata/RDFa – a microdata format that is embedded directly within your site’s content markup
- JSON-LD – an entirely separate document embedded within a page which uses microdata to describe the content on the page
If you are wondering which style of microdata to use, the answer is that you should probably use both (but it needs to be done correctly).
Search engines and content aggregators that regularly scrape your website, like Google, will strongly prefer the JSON-LD style of microdata. JSON-LD describes what is on a webpage, but it doesn’t identify any specific elements within a web page. This format is much stricter and easier for machines to accurately parse and understand.
Microdata/RDFa formats allow for specific content within a webpage to be annotated to provide additional context for data within the element. Examples include:
- This h1 tag is the title of an event
- This number is how many ounces to use for a recipe
This type of contextual data allows tools and browser plugins to alter and annotate the content of your website for users that are directly engaged with a particular part of your website.
- Contextual actions (like Add this Event to my Calendar functions)
- Automated conversion tools (units of measurement or currency)
- Shopping and price comparison tools
- Language translations
- Accessibility tools
Using Microdata for Scheduled Events
Dates are often written in very culture-specific formats. People (and machines) in North America will assume that 6/5 is June 5th. However, in much of the world, that date will be interpreted as May 6th, instead. In order to help everyone understand the meaning of a date or time displayed on a page, special attention is needed for dates:
<span property="startDate">June 5, 2020</span>
Dates should provide an additional content attribute specifying the date value in an ISO 8601 format: 4-digit Year–2-digit Month–2-digit Day
<span property="startDate" content="2020-06-05">June 5, 2020</span>
When specifying a time for an event, the date and time value should be in an ISO 8601 format that also includes the UTC timezone offset value:
<span propery="startTime" content="2020-06-05T19:00:00-05:00">June 5 at 7pm</span>
TIP: Dates and times can be complicated. Check out Google’s Event Guide to specifying dates, times, and even repeating event schedules.
Using Microdata to Handle Phone Calls
Phone numbers come in many formats and often contain assumed values like area codes and country codes. Providing the full international calling number can help ensure that the number is accurately understood.
<span property="telephone">(616) 365-1000</span>
When possible, webmasters should provide an international calling format for phone numbers.
<span property="telephone" content="+16163651000">(616) 365-1000</span>
TIP: If you need help formatting numbers in code, libphonenumber is an excellent library for parsing and displaying phone numbers. It’s also available for most programming languages.
How to Use Microdata to Set Prices
Prices can be ambiguous in a global marketplace. In Argentina, $5.00 could mean 5 Argentine Pesos instead of 5 U.S. Dollars. With the rise of cryptocurrencies or even things like R$5 (that’s 5 Robux), it’s important to specify the currency used when displaying prices so that automated tools can convert the value to a user’s preferred currency.
It is preferred to represent currency like this:
<span property="priceCurrency" content="USD">$</span><span property="price" content="1000.00">1,000.00</span>
The priceCurrency should specify the ISO 4217 3-Letter currency code or ticker symbol for cryptocurrencies. The price should also contain a content property without any formatting symbols, such as any commas or currency.
Additional Tools and Resources for RDF Microdata
If you’re curious about adding microdata to your site or inspecting what automated tools may already be seeing when they review your site, these are some great tools:
Structured Data Testing Tool: This tool is great for testing out what Google sees when it looks at a specific page. The tool parses the page for structured data and displays results of its findings as well as warnings that may help you improve your results. You can even use the Structured Data Testing Tool to debug and test adjustments to your microdata, which makes it easy to find and fix errors.
Markup Helper: Markup Helper is a tool that can scan an existing webpage and provide some suggested markup for improving the structured data content on that page.
Data Highlighter: Data Highlighter is a tool that can be used to test and preview what a highlighted search result will look like for a given web page.
Accessibility: The AY11 project is working with Schema.org to provide a specific set of microdata for accessibility.
SPARQL (SPARQL Protocol and RDF Query Language): Besides being a clever recursive backronym, SPARQL (pronounced “sparkle“), is a query language that can be used to search structured data.
Learn More About Implementing Microdata with Help from CQL
Contact CQL today if you’re interested in adding microdata to your site or would just like to know more about how to improve your business’ appearance in search results. Our web development and digital marketing teams can help you select and implement the best-possible markup for your industry and target audience.