Search
  • Rob Brown

Creating the Gym Search engine optimization sample

This article discusses how the Gym Search engine optimization sample was created and how it can be used to improve a website's visibility. All files can be downloaded from the Tag Samples app.


The goals for this project are as follows:

  • Use schema.org terminology to digitally describe the gym

  • Create forms in Tag to gather data that uses this terminology

  • Save a copy of the data in a format that can be added to a website

This article assumes you have read the Creating the Gym Member sample blog already. That post provides more detailed steps for new Tag users.


1. Discover schema.org terms


The Tag Samples app contains copies of 877 classes published by schema.org that can be used in smart content projects. One of the ways to use them is for Search Engine Optimization (SEO).


SEO refers to the process of enhancing your website to increase its visibility for web searches. While there are different ways to accomplish this, using schema.org terminology is one of the most popular and powerful.


The easiest way to find terms, or classes, of interest is to browse the schema.org hierarchy. When considering the online profile of a gym, these classes seem relevant:


2. Customize data setup


This example will use ExerciseGym and ExhibitionEvent to demonstrate how SEO data can be gathered and communicated to search engines.


First create a folder to store sample files. Then start Tag, go to the Samples app and select that folder in the file tree on the left side. The folder for this example is C:\gymSEO.


Select the schema.org Event sample and then select the ExhibitionEvent.rng checkbox in the right hand list of files. Click the copy arrow icon to copy the file into your sample folder.


Repeat the same steps for the schema.org Organization sample and the ExerciseGym.rng file. Your screen should now look like this.



Next select the ExerciseGym.rng and click the pencil tool. This will jump you directly to the Smart content app and the data setup screen.


There are more than 100 fields defined in this file covering many aspects of a gym's online profile. Fortunately, this example is only concerned with improving search results. That makes it easier to narrow the set of fields down.


Google has some great documentation that explains structured data and how to use it. In some cases, they specifically list the narrow set of fields they currently look at.


For ExerciseGym, the most important search-related fields are linked to identity, location, how to connect and branding. Accordingly, these fields have been selected for the demo.

  • name - of the organization

  • url - website home page

  • description - an award won by or for this item

  • sameAs - used to link to Twitter, YouTube, LinkedIn and other online identities

  • email - general contact email address

  • image - larger banner image

  • logo - smaller logo image

  • telephone - general contact phone number

Some fields were left out to keep things simple (e.g., address, openingHours). All these fields are known to inform what Google calls "rich result display", which is a desired outcome in most cases. The following screenshot is from the Google doc linked-to above.



You can leave all the other fields where they are, in case they get used later. Tag has a way to hide unused fields in forms (see below).


schema.org properties which store numerical or date fields are detected in Tag. All others are treated as plain text. You can change some of the text fields to use a Text area form control instead of a Textbox. This is helpful if you need to paste URLs or enter longer text values.


These ExerciseGym fields were changed to text area: url, description, sameAs, image and logo.


For ExhibitionEvent, there is also an opportunity to Get your event on Google. This informs an improved mobile experience related to attending an event. These are the fields used in this demo.

  • name - name of event

  • startDate - start date of the event

  • endDate - end date of the event

  • description - a short text description of the event

  • image - images of the event

Again some fields were left out to keep things simple (e.g., location, offers, performer).


These ExhibitionEvent fields were changed to text area: description and image.


The data setup files are now done. You can rename them as long as you keep the same namespace, or use one that ends in the same local name (e.g., ExerciseGym) that matches the corresponding schema.org class name.


3. Create a report to connect everything


The Smart content app uses multiple file types as a bundle to improve task automation. The data setup files form a foundation of data fields that the other file types use. The template files act like glue to connect all the file types into a "report" (defined as a template file with a start template).


Therefore, even if you don't want a *.docx document you still need at least one template file. The template file imports data setup files which together define exactly what data is visible. The data files are linked to a single report and display using automatically generated forms.


Reports can also be used to filter which form controls display. Specifically, you can hide all form controls that are never referenced by a template. This is discussed further below.


For this demo, a small report with a table is used to summarize the SEO data gathered. This content may never be used to generate a *.docx file, but it will be useful to filter form controls. On the other hand, a *.docx file like this may be useful as part of a monthly summary of published SEO information for gym management.


To create a report, go to the Templates area of the Smart content app. Create a new template file called gym-seo.xsl and import the two data setup files copied from schema.org.


The start template is no-frills and looks like this.



As long as all data fields of interest are referenced in some way, the template is done.


4. Gather data


Next, go to the Forms area of the Smart content app. Create a new data file called seo1.nsdata that references the gym-seo.xsl report.


When you look at the forms for ExerciseGym and ExhibitionEvent, only the fields used above are displayed by default. You can turn this filter on/off with the More button at the top of each form.



Once the forms are filled in, you can export a JSON-LD script fragment containing SEO data.


5. Export SEO script


Using the More icon beneath the file tree, select the Export / schema.org SEO script... menu item. Specify a file name for a *.jsonld file and click OK.


The contents of this file can be embedded in your website's HTML markup. Usually it's stored as content of a <script> element that is a child of <head>. For example,

    <script type="application/ld+json">
      ... generated script goes here ...
    </script>

General data about the organization should only be added once to a website (e.g., on the home page). More specific fragments (e.g., for the exhibition event) should be added to specific landing pages that provide more detail. This demo groups them together only to simplify discussion.


Google provides two ways to validate the exported script:


Structured Data Testing Tool

Rich Results Test


The script created by this demo passed the first test but not the second. Therefore, it is valid but not deemed detailed enough for rich result display. That's not surprising, since we left out some data fields to keep things simple and used fake web URLs.


To see some examples of rich result display visit Google's search gallery.


The script created by this demo is shown here.

{
  "@context" : {
    "startDate" : "https://schema.org/startDate",
    "name" : "https://schema.org/name",
    "image" : "https://schema.org/image",
    "endDate" : "https://schema.org/endDate",
    "description" : "https://schema.org/description",
    "url" : "https://schema.org/url",
    "telephone" : "https://schema.org/telephone",
    "sameAs" : "https://schema.org/sameAs",
    "logo" : "https://schema.org/logo",
    "email" : "https://schema.org/email"
  },
  "@graph" : [ {
    "@id" : "_:b0",
    "@type" : "https://schema.org/ExhibitionEvent",
    "description" : "An exhibition of skills by gym members and coaches.",
    "endDate" : "2021-04-01",
    "image" : "http://www.example.org/exhibition.png",
    "name" : "Skills Day",
    "startDate" : "2021-04-01"
  }, {
    "@id" : "_:b1",
    "@type" : "https://schema.org/ExerciseGym",
    "description" : "Modern gym with all the latest equipment.",
    "email" : "info@mygym.org",
    "image" : "https://mygym.org/gym.png",
    "logo" : "https://mygym.org/logo.png",
    "name" : "My Gym",
    "sameAs" : "https://twitter.com/mygym",
    "telephone" : "555-555-1212",
    "url" : "https://mygym.org/"
  } ]
}

6. Generate summary document


The final (optional) step is to generate a *.docx summary document. While still in the Forms area, select the Generate tab (magic wand in a circle). If the wand icon on that page is available, you can generate the document shown below. You can add more content using the Templates editor.



The example is now complete. You can download all discussed files from the Samples app in Tag by selecting the Gym demos / Search engine optimization sample.


#seo #schemaorg



8 views0 comments

Recent Posts

See All