<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Local Business Directory</title>
    <description>The latest articles on DEV Community by Local Business Directory (@localbizdirectoryin).</description>
    <link>https://dev.to/localbizdirectoryin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4262071%2Ff3e801b3-e53f-4693-8ba9-b8809269c3a7.png</url>
      <title>DEV Community: Local Business Directory</title>
      <link>https://dev.to/localbizdirectoryin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/localbizdirectoryin"/>
    <language>en</language>
    <item>
      <title>5 rules we follow for LocalBusiness schema on an Indian business directory</title>
      <dc:creator>Local Business Directory</dc:creator>
      <pubDate>Tue, 24 Nov 2026 07:34:32 +0000</pubDate>
      <link>https://dev.to/localbizdirectoryin/5-rules-we-follow-for-localbusiness-schema-on-an-indian-business-directory-3ij1</link>
      <guid>https://dev.to/localbizdirectoryin/5-rules-we-follow-for-localbusiness-schema-on-an-indian-business-directory-3ij1</guid>
      <description>&lt;p&gt;We run &lt;a href="https://localbusinessdirectory.in/" rel="noopener noreferrer"&gt;Local Business Directory&lt;/a&gt;, a listing site for local service providers across Indian cities: plumbers, clinics, coaching centres, caterers and so on. Each business page ships a &lt;code&gt;LocalBusiness&lt;/code&gt; JSON-LD node. Getting that markup &lt;em&gt;valid&lt;/em&gt; is easy. Getting it &lt;em&gt;trustworthy&lt;/em&gt;, so Google keeps showing rich results instead of quietly dropping them, took a few rules. Here they are, with the PHP we use.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Only use types that actually exist in schema.org
&lt;/h2&gt;

&lt;p&gt;Our admin lets each category pick a schema type. Early on that list contained &lt;code&gt;Gym&lt;/code&gt;, &lt;code&gt;Lodging&lt;/code&gt;, &lt;code&gt;ITService&lt;/code&gt; and &lt;code&gt;MarketingAgency&lt;/code&gt;. None of those are schema.org types. Validators don't always complain, but the node silently falls back to nothing useful.&lt;/p&gt;

&lt;p&gt;Now the allowed list is checked against the real vocabulary in a unit test, and old stored values are mapped to the nearest real type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;legacySchemaTypes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'Gym'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'ExerciseGym'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'Lodging'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'LodgingBusiness'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'ITService'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'ProfessionalService'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'MarketingAgency'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'ProfessionalService'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anything still unknown falls back to plain &lt;code&gt;LocalBusiness&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Pair types that are not LocalBusiness subtypes
&lt;/h2&gt;

&lt;p&gt;A coaching institute is an &lt;code&gt;EducationalOrganization&lt;/code&gt;, but it is also a local business with an address and hours. &lt;code&gt;EducationalOrganization&lt;/code&gt; is not a subtype of &lt;code&gt;LocalBusiness&lt;/code&gt;, so we emit both:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;in_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;pairedBusinessTypes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'LocalBusiness'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$type&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same for &lt;code&gt;School&lt;/code&gt;, &lt;code&gt;VeterinaryCare&lt;/code&gt;, &lt;code&gt;EventVenue&lt;/code&gt; and &lt;code&gt;TouristAttraction&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. No aggregateRating without on-site reviews
&lt;/h2&gt;

&lt;p&gt;Many listings arrive with a rating copied from a public map profile. It is tempting to mark that up. Google's review-snippet policy says the reviews behind an &lt;code&gt;aggregateRating&lt;/code&gt; must be collected by your site and readable on the page. A borrowed rating fails both, and marking it up is a manual-action risk.&lt;/p&gt;

&lt;p&gt;So the rating still shows on the page as a labelled figure, but it only becomes structured data when its source is our own reviews:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$rating&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'source'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'onsite'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Opening hours only for days that were actually stated
&lt;/h2&gt;

&lt;p&gt;If an owner gave hours for Monday to Saturday and said nothing about Sunday, we emit six entries, not seven. Guessing "closed" or copying Saturday's hours would be wrong. Days explicitly marked closed are emitted with &lt;code&gt;opens&lt;/code&gt; and &lt;code&gt;closes&lt;/code&gt; both &lt;code&gt;00:00&lt;/code&gt;, which is how schema.org expresses closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Drop an address that has nothing in it
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;PostalAddress&lt;/code&gt; with only &lt;code&gt;addressCountry: IN&lt;/code&gt; is noise. We build it from whatever parts exist (street, locality, region, PIN code) and return nothing at all if all of them are empty. Geo coordinates follow the same rule: both latitude and longitude, or neither.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why bother
&lt;/h2&gt;

&lt;p&gt;Rich results for local listings are fragile. Each of these rules came from a page that validated fine but lost its rich result, or from a policy page we read too late. If you run a directory, a marketplace or any site with many small-business pages, these are cheap checks to add before Google adds them for you.&lt;/p&gt;

&lt;p&gt;You can see the markup on any listing at &lt;a href="https://localbusinessdirectory.in/" rel="noopener noreferrer"&gt;localbusinessdirectory.in&lt;/a&gt; (view source and search for &lt;code&gt;application/ld+json&lt;/code&gt;).&lt;/p&gt;

</description>
      <category>seo</category>
      <category>php</category>
      <category>webdev</category>
      <category>schema</category>
    </item>
  </channel>
</rss>
