<?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: Perfect Web Group</title>
    <description>The latest articles on DEV Community by Perfect Web Group (@perfectwebgroup).</description>
    <link>https://dev.to/perfectwebgroup</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%2F4274276%2Fee930edb-914a-47fa-94fe-4628edfea956.jpg</url>
      <title>DEV Community: Perfect Web Group</title>
      <link>https://dev.to/perfectwebgroup</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/perfectwebgroup"/>
    <language>en</language>
    <item>
      <title>Copy-Paste JSON-LD Templates for Local Business Websites</title>
      <dc:creator>Perfect Web Group</dc:creator>
      <pubDate>Mon, 30 Nov 2026 13:28:46 +0000</pubDate>
      <link>https://dev.to/perfectwebgroup/copy-paste-json-ld-templates-for-local-business-websites-3ock</link>
      <guid>https://dev.to/perfectwebgroup/copy-paste-json-ld-templates-for-local-business-websites-3ock</guid>
      <description>&lt;p&gt;Structured data helps search engines and AI systems understand who you are, where you operate and what each page is about. If you already know why schema matters, from our guide to &lt;a href="https://www.perfectwebgroup.com/schema-markup-structured-data-dubai-business" rel="noopener noreferrer"&gt;schema markup for Dubai businesses&lt;/a&gt;, this page gives you the practical part: JSON-LD schema templates you can copy, edit and validate.&lt;/p&gt;

&lt;p&gt;Replace every value in capitals with your real details. Never mark up information that is not visible or true on the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Organization
&lt;/h2&gt;

&lt;p&gt;Place this on the homepage, or site-wide, to define your business as an entity.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://WWW.YOURDOMAIN.AE/#organization",
  "name": "YOUR BUSINESS NAME",
  "url": "https://WWW.YOURDOMAIN.AE/",
  "logo": "https://WWW.YOURDOMAIN.AE/LOGO.PNG",
  "sameAs": [
    "https://WWW.LINKEDIN.COM/COMPANY/YOURCOMPANY",
    "https://WWW.INSTAGRAM.COM/YOURCOMPANY"
  ]
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  2. LocalBusiness
&lt;/h2&gt;

&lt;p&gt;Use a specific subtype where one fits, such as &lt;code&gt;ProfessionalService&lt;/code&gt;, &lt;code&gt;HomeAndConstructionBusiness&lt;/code&gt; or &lt;code&gt;Dentist&lt;/code&gt;. The address and phone number must match your Google Business Profile exactly.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;
{
  "@context": "https://schema.org",
  "@type": "ProfessionalService",
  "@id": "https://WWW.YOURDOMAIN.AE/#localbusiness",
  "name": "YOUR BUSINESS NAME",
  "url": "https://WWW.YOURDOMAIN.AE/",
  "telephone": "+971-YOUR-PHONE-NUMBER",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "OFFICE, BUILDING, STREET",
    "addressLocality": "Dubai",
    "addressRegion": "Dubai",
    "addressCountry": "AE"
  },
  "areaServed": ["Dubai", "Sharjah", "Abu Dhabi"],
  "openingHoursSpecification": [{
    "@type": "OpeningHoursSpecification",
    "dayOfWeek": ["Monday","Tuesday","Wednesday","Thursday","Friday"],
    "opens": "09:00",
    "closes": "18:00"
  }],
  "parentOrganization": { "@id": "https://WWW.YOURDOMAIN.AE/#organization" }
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;UAE addresses often lack postcodes. Leave &lt;code&gt;postalCode&lt;/code&gt; out rather than inventing one, and add a P.O. Box only if you actually use it publicly.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Service
&lt;/h2&gt;

&lt;p&gt;Add to each service page to describe the offer and link it to your business.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;&lt;br&gt;
{&lt;br&gt;
  "@context": "&lt;a href="https://schema.org" rel="noopener noreferrer"&gt;https://schema.org&lt;/a&gt;",&lt;br&gt;
  "@type": "Service",&lt;br&gt;
  "name": "SERVICE NAME",&lt;br&gt;
  "serviceType": "SERVICE CATEGORY",&lt;br&gt;
  "description": "ONE OR TWO SENTENCES MATCHING THE PAGE.",&lt;br&gt;
  "provider": { "@id": "&lt;a href="https://WWW.YOURDOMAIN.AE/#organization" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/#organization&lt;/a&gt;" },&lt;br&gt;
  "areaServed": { "@type": "Country", "name": "United Arab Emirates" },&lt;br&gt;
  "url": "&lt;a href="https://WWW.YOURDOMAIN.AE/SERVICES/SERVICE-SLUG" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/SERVICES/SERVICE-SLUG&lt;/a&gt;"&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;BreadcrumbList
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;


&lt;p&gt;Mirror the visible breadcrumb trail. Our &lt;a href="https://www.perfectwebgroup.com/breadcrumbs-breadcrumblist-schema-guide" rel="noopener noreferrer"&gt;breadcrumb schema guide&lt;/a&gt; explains how to generate this automatically.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;&lt;br&gt;
{&lt;br&gt;
  "@context": "&lt;a href="https://schema.org" rel="noopener noreferrer"&gt;https://schema.org&lt;/a&gt;",&lt;br&gt;
  "@type": "BreadcrumbList",&lt;br&gt;
  "itemListElement": [&lt;br&gt;
    {"@type": "ListItem", "position": 1, "name": "Home", "item": "&lt;a href="https://WWW.YOURDOMAIN.AE/%22" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/"&lt;/a&gt;},&lt;br&gt;
    {"@type": "ListItem", "position": 2, "name": "Services", "item": "&lt;a href="https://WWW.YOURDOMAIN.AE/SERVICES%22" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/SERVICES"&lt;/a&gt;},&lt;br&gt;
    {"@type": "ListItem", "position": 3, "name": "SERVICE NAME"}&lt;br&gt;
  ]&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;Article
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;


&lt;p&gt;For blog posts and guides. Keep dates accurate and update &lt;code&gt;dateModified&lt;/code&gt; only for meaningful changes.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;&lt;br&gt;
{&lt;br&gt;
  "@context": "&lt;a href="https://schema.org" rel="noopener noreferrer"&gt;https://schema.org&lt;/a&gt;",&lt;br&gt;
  "@type": "Article",&lt;br&gt;
  "headline": "ARTICLE TITLE",&lt;br&gt;
  "image": "&lt;a href="https://WWW.YOURDOMAIN.AE/IMAGES/FEATURED.WEBP" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/IMAGES/FEATURED.WEBP&lt;/a&gt;",&lt;br&gt;
  "datePublished": "2026-01-15",&lt;br&gt;
  "dateModified": "2026-01-20",&lt;br&gt;
  "author": { "@type": "Person", "name": "AUTHOR NAME" },&lt;br&gt;
  "publisher": { "@id": "&lt;a href="https://WWW.YOURDOMAIN.AE/#organization" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/#organization&lt;/a&gt;" },&lt;br&gt;
  "mainEntityOfPage": "&lt;a href="https://WWW.YOURDOMAIN.AE/ARTICLE-SLUG" rel="noopener noreferrer"&gt;https://WWW.YOURDOMAIN.AE/ARTICLE-SLUG&lt;/a&gt;"&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  

&lt;ol&gt;
&lt;li&gt;FAQPage
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;


&lt;p&gt;Since 2023 Google shows FAQ rich results mainly for well-known government and health websites, so most businesses will not get the expanded result. The markup is still valid and can help other systems read your questions and answers. Only mark up questions that appear on the page.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;&lt;br&gt;
{&lt;br&gt;
  "@context": "&lt;a href="https://schema.org" rel="noopener noreferrer"&gt;https://schema.org&lt;/a&gt;",&lt;br&gt;
  "@type": "FAQPage",&lt;br&gt;
  "mainEntity": [{&lt;br&gt;
    "@type": "Question",&lt;br&gt;
    "name": "QUESTION TEXT?",&lt;br&gt;
    "acceptedAnswer": { "@type": "Answer", "text": "ANSWER TEXT." }&lt;br&gt;
  }]&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Connect Your Entities With &lt;a class="mentioned-user" href="https://dev.to/id"&gt;@id&lt;/a&gt;&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;Using the same &lt;code&gt;@id&lt;/code&gt; values across templates tells search engines that the Organization on your homepage is the same provider named on every service and article. This connected approach supports the entity signals described in our guide to &lt;a href="https://www.perfectwebgroup.com/entity-seo-ai-search-visibility" rel="noopener noreferrer"&gt;entity SEO for AI search visibility&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate Before and After Publishing
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Run each page through Google's Rich Results Test and the Schema Markup Validator.&lt;/li&gt;
&lt;li&gt; Fix errors first; warnings for optional properties can wait.&lt;/li&gt;
&lt;li&gt; After launch, check the Enhancements reports in Search Console.&lt;/li&gt;
&lt;li&gt; Re-test after template or CMS updates, which often break markup silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Google's &lt;a href="https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data" rel="noopener noreferrer"&gt;introduction to structured data&lt;/a&gt; lists the general guidelines every markup must follow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate Schema From Your CMS, Not by Hand
&lt;/h2&gt;

&lt;p&gt;Hand-pasted JSON-LD goes stale when phone numbers, prices or titles change. In Laravel or WordPress, build these templates into your layouts and fill them from the same fields that render the page. Our &lt;a href="https://www.perfectwebgroup.com/services/web-development" rel="noopener noreferrer"&gt;web development team&lt;/a&gt; implements automated schema as part of technical SEO builds.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.perfectwebgroup.com/json-ld-schema-templates-uae-businesses" rel="noopener noreferrer"&gt;Perfect Web Group&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>seo</category>
      <category>webdev</category>
      <category>json</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Robots Meta Tag vs X-Robots-Tag: Apache, Nginx and Laravel Examples</title>
      <dc:creator>Perfect Web Group</dc:creator>
      <pubDate>Mon, 30 Nov 2026 13:28:30 +0000</pubDate>
      <link>https://dev.to/perfectwebgroup/robots-meta-tag-vs-x-robots-tag-apache-nginx-and-laravel-examples-3lgp</link>
      <guid>https://dev.to/perfectwebgroup/robots-meta-tag-vs-x-robots-tag-apache-nginx-and-laravel-examples-3lgp</guid>
      <description>&lt;p&gt;Sometimes a page should exist for users but stay out of search results: thank-you pages, internal search results, staging copies or downloadable files meant only for customers. The robots meta tag and the X-Robots-Tag HTTP header are the two ways to give search engines indexing instructions. They support the same directives but work in different places.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Robots Meta Tag
&lt;/h2&gt;

&lt;p&gt;The robots meta tag sits in the HTML head of a page:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;meta name="robots" content="noindex, follow"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It is the simplest option for HTML pages and can usually be controlled per page in a CMS. You can also target one crawler by replacing &lt;code&gt;robots&lt;/code&gt; with a specific name, such as &lt;code&gt;googlebot&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The X-Robots-Tag Header
&lt;/h2&gt;

&lt;p&gt;The same directives can be sent as an HTTP response header:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;X-Robots-Tag: noindex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because headers work for any file type, this is the method to use for PDFs, images, spreadsheets and other non-HTML resources. It is also convenient for applying rules to whole folders or file types from the server configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Apache example for PDFs
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;FilesMatch ".pdf$"&amp;gt;&lt;br&gt;
  Header set X-Robots-Tag "noindex"&lt;br&gt;
&amp;lt;/FilesMatch&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Nginx example&lt;br&gt;
&lt;/h3&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;location ~* .pdf$ {&lt;br&gt;
    add_header X-Robots-Tag "noindex";&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Laravel middleware example&lt;br&gt;
&lt;/h3&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return $next($request)-&amp;gt;header('X-Robots-Tag', 'noindex');&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Common Directives&lt;br&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;noindex:&lt;/strong&gt; do not show this page in search results.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;nofollow:&lt;/strong&gt; do not follow links on this page. Rarely needed on your own site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;none:&lt;/strong&gt; equivalent to noindex, nofollow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;nosnippet:&lt;/strong&gt; do not show a text snippet or video preview.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;max-snippet, max-image-preview, max-video-preview:&lt;/strong&gt; limit how much of the page appears in results.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;noimageindex:&lt;/strong&gt; do not index images on this page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;unavailable_after:&lt;/strong&gt; stop showing the page after a given date, useful for time-limited offers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Robots Directives vs robots.txt
&lt;/h2&gt;

&lt;p&gt;This is the most common source of confusion. Robots.txt controls &lt;em&gt;crawling&lt;/em&gt;; robots directives control &lt;em&gt;indexing&lt;/em&gt;. If robots.txt blocks a URL, search engines cannot fetch it and therefore cannot see its noindex tag. A blocked URL can still appear in results, without a description, if other pages link to it.&lt;/p&gt;

&lt;p&gt;To remove a page from results, allow crawling and use noindex. Only block it in robots.txt after it has dropped out of the index, and only if you need to save crawl resources. Our guide to &lt;a href="https://www.perfectwebgroup.com/understanding-robots-txt-for-crawling" rel="noopener noreferrer"&gt;robots.txt for crawling&lt;/a&gt; covers the crawling side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pages That Usually Need noindex
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Form confirmation and thank-you pages.&lt;/li&gt;
&lt;li&gt;Internal site search results.&lt;/li&gt;
&lt;li&gt;Login, account and cart pages.&lt;/li&gt;
&lt;li&gt;Thin tag or filter pages with no search demand.&lt;/li&gt;
&lt;li&gt;Staging and development environments, ideally also protected by a password.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Mistakes to Avoid
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Leaving noindex on after launch:&lt;/strong&gt; staging settings copied to production can remove a whole site from search. Add a launch check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Noindex on pages listed in the sitemap:&lt;/strong&gt; sitemaps should list only indexable URLs, as explained in our &lt;a href="https://www.perfectwebgroup.com/beginners-guide-to-xml-sitemaps" rel="noopener noreferrer"&gt;XML sitemap guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixing noindex with a canonical to another URL:&lt;/strong&gt; see our &lt;a href="https://www.perfectwebgroup.com/canonical-tags-guide" rel="noopener noreferrer"&gt;canonical tags guide&lt;/a&gt; for why this sends conflicting signals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conflicting header and meta values:&lt;/strong&gt; when both exist, search engines apply the most restrictive. Keep one source of truth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Check Directives
&lt;/h2&gt;

&lt;p&gt;Use the URL Inspection tool in Search Console to see whether indexing is allowed. To see headers, open your browser's developer tools, select the Network tab and inspect the response headers of the document or file. Crawling tools can report both meta and header directives across a whole site.&lt;/p&gt;

&lt;p&gt;Need indexing rules implemented cleanly across templates and file downloads? Our &lt;a href="https://www.perfectwebgroup.com/services/web-development" rel="noopener noreferrer"&gt;web development team&lt;/a&gt; builds them into Laravel and WordPress projects.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.perfectwebgroup.com/robots-meta-tag-vs-x-robots-tag" rel="noopener noreferrer"&gt;Perfect Web Group&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>seo</category>
      <category>nginx</category>
      <category>laravel</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Generating JSON-LD Structured Data in Laravel With a Blade Component</title>
      <dc:creator>Perfect Web Group</dc:creator>
      <pubDate>Mon, 30 Nov 2026 13:28:13 +0000</pubDate>
      <link>https://dev.to/perfectwebgroup/generating-json-ld-structured-data-in-laravel-with-a-blade-component-453l</link>
      <guid>https://dev.to/perfectwebgroup/generating-json-ld-structured-data-in-laravel-with-a-blade-component-453l</guid>
      <description>&lt;p&gt;Hand-written structured data goes stale as soon as titles, dates or prices change. The fix is to generate it from the same data that renders the page. This tutorial shows a clean way to produce Laravel JSON-LD with a small Blade component and model methods, so every page outputs valid, consistent schema automatically. For copy-ready schema shapes, see our &lt;a href="https://www.perfectwebgroup.com/json-ld-schema-templates-uae-businesses" rel="noopener noreferrer"&gt;JSON-LD schema templates&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the Component
&lt;/h2&gt;

&lt;p&gt;Generate an anonymous Blade component at &lt;code&gt;resources/views/components/json-ld.blade.php&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@props(['data'])
@if (! empty($data))
&amp;lt;script type="application/ld+json"&amp;gt;{!! json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG) !!}&amp;lt;/script&amp;gt;
@endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;JSON_HEX_TAG&lt;/code&gt; flag escapes &lt;code&gt;&amp;lt;&lt;/code&gt; and &lt;code&gt;&amp;gt;&lt;/code&gt;, so content such as a title containing &lt;code&gt;&amp;lt;/script&amp;gt;&lt;/code&gt; cannot break out of the script element. &lt;code&gt;JSON_UNESCAPED_UNICODE&lt;/code&gt; keeps Arabic text readable.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Add a Schema Method to the Model
&lt;/h2&gt;

&lt;p&gt;Keep schema logic close to the data. For a blog post model:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function toSchema(): array
{
    $url = route('posts.show', $this);

    return [
        '@context' =&amp;gt; 'https://schema.org',
        '@type' =&amp;gt; 'BlogPosting',
        '@id' =&amp;gt; $url.'#article',
        'headline' =&amp;gt; $this-&amp;gt;title,
        'description' =&amp;gt; $this-&amp;gt;meta_description,
        'image' =&amp;gt; $this-&amp;gt;featured_image_url,
        'datePublished' =&amp;gt; $this-&amp;gt;published_at?-&amp;gt;toIso8601String(),
        'dateModified' =&amp;gt; $this-&amp;gt;updated_at?-&amp;gt;toIso8601String(),
        'author' =&amp;gt; ['@type' =&amp;gt; 'Person', 'name' =&amp;gt; $this-&amp;gt;author?-&amp;gt;name],
        'publisher' =&amp;gt; ['@id' =&amp;gt; url('/').'#organization'],
        'mainEntityOfPage' =&amp;gt; $url,
    ];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Remove empty values before output so optional fields never appear as null:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return array_filter($schema, fn ($v) =&amp;gt; $v !== null &amp;amp;&amp;amp; $v !== '');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  3. Build Breadcrumbs From the Route
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static function breadcrumbs(array $items): array
{
    return [
        '@context' =&amp;gt; 'https://schema.org',
        '@type' =&amp;gt; 'BreadcrumbList',
        'itemListElement' =&amp;gt; collect($items)-&amp;gt;values()-&amp;gt;map(fn ($item, $i) =&amp;gt; array_filter([
            '@type' =&amp;gt; 'ListItem',
            'position' =&amp;gt; $i + 1,
            'name' =&amp;gt; $item['name'],
            'item' =&amp;gt; $item['url'] ?? null,
        ]))-&amp;gt;all(),
    ];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Use the same array to render the visible breadcrumb trail, so markup and page always match. Our &lt;a href="https://www.perfectwebgroup.com/breadcrumbs-breadcrumblist-schema-guide" rel="noopener noreferrer"&gt;breadcrumb schema guide&lt;/a&gt; explains the rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Combine Into a Graph
&lt;/h2&gt;

&lt;p&gt;Instead of several unrelated scripts, output one &lt;code&gt;@graph&lt;/code&gt; that links your Organization, WebPage and Article through &lt;code&gt;@id&lt;/code&gt; references:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;x-json-ld :data="[
    '@context' =&amp;gt; 'https://schema.org',
    '@graph' =&amp;gt; [$organization, $post-&amp;gt;toSchema(), $breadcrumbs],
]" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Remove the inner &lt;code&gt;@context&lt;/code&gt; keys when nesting inside a graph. Connected entities help search engines understand relationships, as discussed in our guide to &lt;a href="https://www.perfectwebgroup.com/entity-seo-ai-search-visibility" rel="noopener noreferrer"&gt;entity SEO&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Cache Where It Helps
&lt;/h2&gt;

&lt;p&gt;Schema generation is cheap, but organisation data that rarely changes can be cached in configuration or a settings cache. Avoid caching per-page schema separately from the page; regenerate it whenever the page is rendered or cached.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Test It
&lt;/h2&gt;

&lt;p&gt;A feature test can decode the output and assert key fields:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$html = $this-&amp;gt;get('/'.$post-&amp;gt;slug)-&amp;gt;assertOk()-&amp;gt;getContent();
preg_match('~&amp;lt;script type="application/ld\+json"&amp;gt;(.*?)&amp;lt;/script&amp;gt;~s', $html, $m);
$json = json_decode($m[1], true);
$this-&amp;gt;assertSame($post-&amp;gt;title, $json['@graph'][1]['headline']);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Also validate a sample of live pages with Google's Rich Results Test after each release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Pitfalls
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Outputting relative image or page URLs; always use absolute URLs.&lt;/li&gt;
&lt;li&gt;Marking up content that is not visible on the page.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;{{ }}&lt;/code&gt; instead of a raw JSON output, which HTML-escapes quotes and breaks the JSON.&lt;/li&gt;
&lt;li&gt;Forgetting to update &lt;code&gt;dateModified&lt;/code&gt; when content changes meaningfully.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our &lt;a href="https://www.perfectwebgroup.com/services/web-development" rel="noopener noreferrer"&gt;web development team&lt;/a&gt; builds automated schema, canonicals and sitemaps into Laravel projects as standard. For a wider checklist, see our &lt;a href="https://www.perfectwebgroup.com/laravel-technical-seo-audit" rel="noopener noreferrer"&gt;Laravel technical SEO audit&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://www.perfectwebgroup.com/laravel-json-ld-blade-component" rel="noopener noreferrer"&gt;Perfect Web Group&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

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