Last active
June 15, 2021 04:38
-
-
Save mbaxter91288/216d478068af9be5bdc234d8aefb7e40 to your computer and use it in GitHub Desktop.
Add JSON-LD structured data into your October CMS website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if this.theme.type and | |
this.theme.name %} | |
<script type="application/ld+json"> | |
{ | |
"@context": "http://schema.org", | |
"@type": "{{ this.theme.type }}", | |
"name": "{{ this.theme.name }}", | |
{% if this.theme.description %} | |
"description": "{{ this.theme.description }}", | |
{% endif %} | |
{% if this.theme.email %} | |
"email":"{{ this.theme.email }}", | |
{% endif %} | |
{% if this.theme.telephone_value %} | |
"telephone": "{{ this.theme.telephone_value }}", | |
{% endif %} | |
{% if this.theme.url %} | |
"@id": "{{ this.theme.url }}", | |
"url": "{{ this.theme.url }}", | |
{% endif %} | |
{% if this.theme.logo %} | |
"logo": "{{ this.theme.logo|media }}", | |
{% endif %} | |
{% if this.theme.image %} | |
"image": "{{ this.theme.image|media }}", | |
{% endif %} | |
{% if this.theme.streetAddress and | |
this.theme.addressLocality and | |
this.theme.addressRegion and | |
this.theme.postalCode and | |
this.theme.addressCountry %} | |
"address": { | |
"@type":"PostalAddress", | |
"streetAddress":"{{ this.theme.streetAddress }}", | |
"addressLocality":"{{ this.theme.addressLocality }}", | |
"addressRegion":"{{ this.theme.addressRegion }}", | |
"postalCode":"{{ this.theme.postalCode }}", | |
"addressCountry":"{{ this.theme.addressCountry }}" | |
}, | |
{% endif %} | |
{% if this.theme.contact_points|length %} | |
"contactPoint": [ | |
{% for contactPoint in this.theme.contact_points %} | |
{ | |
"@type": "ContactPoint", | |
"telephone": "{{ contactPoint.telephone_value }}", | |
"contactType": "{{ contactPoint.contactType }}", | |
{% if contactPoint.areaServed %} | |
"areaServed": "{{ contactPoint.areaServed }}"{% if contactPoint.contactOption or contactPoint.availableLanguage %}, | |
{% endif %} | |
{% endif %} | |
{% if contactPoint.contactOption %} | |
"contactOption": "{{ contactPoint.contactOption }}"{% if contactPoint.availableLanguage %}, | |
{% endif %} | |
{% endif %} | |
{% if contactPoint.availableLanguage %} | |
"availableLanguage": "{{ contactPoint.availableLanguage }}" | |
{% endif %} | |
}{% if not loop.last %},{% endif %} | |
{% endfor %} | |
], | |
{% endif %} | |
{% if this.theme.mon_open or | |
this.theme.tue_open or | |
this.theme.wed_open or | |
this.theme.thu_open or | |
this.theme.fri_open or | |
this.theme.sat_open or | |
this.theme.sun_open %} | |
"openingHoursSpecification": [ | |
{% if this.theme.mon_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Monday" | |
], | |
"opens": "{{ this.theme.mon_opens }}", | |
"closes": "{{ this.theme.mon_closes }}" | |
}{% if this.theme.tue_open or this.theme.wed_open or this.theme.thu_open or this.theme.fri_open or this.theme.sat_open or this.theme.sun_open %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.tue_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Tuesday" | |
], | |
"opens": "{{ this.theme.tue_opens }}", | |
"closes": "{{ this.theme.tue_closes }}" | |
}{% if this.theme.wed_open or this.theme.thu_open or this.theme.fri_open or this.theme.sat_open or this.theme.sun_open %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.wed_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Wednesday" | |
], | |
"opens": "{{ this.theme.wed_opens }}", | |
"closes": "{{ this.theme.wed_closes }}" | |
}{% if this.theme.thu_open or this.theme.fri_open or this.theme.sat_open or this.theme.sun_open %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.thu_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Thursday" | |
], | |
"opens": "{{ this.theme.thu_opens }}", | |
"closes": "{{ this.theme.thu_closes }}" | |
}{% if this.theme.fri_open or this.theme.sat_open or this.theme.sun_open %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.fri_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Friday" | |
], | |
"opens": "{{ this.theme.fri_opens }}", | |
"closes": "{{ this.theme.fri_closes }}" | |
}{% if this.theme.sat_open or this.theme.sun_open %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.sat_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Saturday" | |
], | |
"opens": "{{ this.theme.sat_opens }}", | |
"closes": "{{ this.theme.sat_closes }}" | |
}{% if this.theme.sun_open %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.sun_open %} | |
{ | |
"@type": "OpeningHoursSpecification", | |
"dayOfWeek": [ | |
"Sunday" | |
], | |
"opens": "{{ this.theme.sun_opens }}", | |
"closes": "{{ this.theme.sun_closes }}" | |
} | |
{% endif %} | |
], | |
{% endif %} | |
{% if latitude and longitude %} | |
"geo":{ | |
"@type":"GeoCoordinates", | |
"latitude":{{ this.theme.latitude }}, | |
"longitude":{{ this.theme.longitude }} | |
}, | |
{% endif %} | |
"sameAs": [ | |
{% if this.theme.facebook %} | |
"{{ this.theme.facebook }}"{% if this.theme.twitter or this.theme.googleplus or this.theme.youtube or this.theme.linkedin or this.theme.instagram or this.theme.pinterest %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.twitter %} | |
"{{ this.theme.twitter }}"{% if this.theme.googleplus or this.theme.youtube or this.theme.linkedin or this.theme.instagram or this.theme.pinterest %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.googleplus %} | |
"{{ this.theme.googleplus }}"{% if this.theme.youtube or this.theme.linkedin or this.theme.instagram or this.theme.pinterest %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.youtube %} | |
"{{ this.theme.youtube }}"{% if this.theme.linkedin or this.theme.instagram or this.theme.pinterest %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.linkedin %} | |
"{{ this.theme.linkedin }}"{% if this.theme.instagram or this.theme.pinterest %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.instagram %} | |
"{{ this.theme.instagram }}"{% if this.theme.pinterest %}, | |
{% endif %} | |
{% endif %} | |
{% if this.theme.pinterest %} | |
"{{ this.theme.pinterest }}" | |
{% endif %} | |
] | |
} | |
</script> | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Your\Namespace\Components; | |
use Cms\Classes\ComponentBase; | |
use Config; | |
class StructuredData extends ComponentBase | |
{ | |
/** | |
* set the component's details | |
* | |
* @return array | |
*/ | |
public function componentDetails() | |
{ | |
return [ | |
'name' => 'Structured Data', | |
'description' => 'Structured data rendered in JSON-LD format.' | |
]; | |
} | |
/** | |
* when the component is called | |
*/ | |
public function onRun() | |
{ | |
/** | |
* get the requested act | |
*/ | |
$this->controller->getTheme()->url = Config::get('app.url'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
form: | |
tabs: | |
fields: | |
name: | |
label: 'Company name' | |
span: left | |
type: text | |
placeholder: 'Company Name' | |
comment: 'Full company name.' | |
tab: 'Company Details' | |
type: | |
label: 'Business type' | |
span: right | |
type: dropdown | |
options: | |
null: '-- PLEASE CHOOSE --' | |
AccountingService: 'Accounting Service' | |
Attorney: 'Attorney' | |
AutoBodyShop: 'Auto Body Shop' | |
AutoDealer: 'Auto Dealer' | |
AutoPartsStore: 'Auto Parts Store' | |
AutoRental: 'Auto Rental' | |
AutoRepair: 'Auto Repair' | |
AutoWash: 'Auto Wash' | |
Bakery: 'Bakery' | |
BarOrPub: 'Bar or Pub' | |
BeautySalon: 'Beauty Salon' | |
BedAndBreakfast: 'Bed and Breakfast' | |
BikeStore: 'Bike Store' | |
BookStore: 'Book Store' | |
CafeOrCoffeeShop: 'Cafe or Coffee Shop' | |
ChildCare: 'Child Care' | |
ClothingStore: 'Clothing Store' | |
ComputerStore: 'Computer Store' | |
DaySpa: 'Day Spa' | |
Dentist: 'Dentist' | |
DryCleaningOrLaundry: 'Dry Cleaning or Laundry' | |
Electrician: 'Electrician' | |
ElectronicsStore: 'Electronics Store' | |
EmergencyService: 'Emergency Service' | |
EntertainmentBusiness: 'Entertainment Business' | |
EventVenue: 'Event Venue' | |
ExerciseGym: 'Exercise Gym' | |
FinancialService: 'Financial Service' | |
Florist: 'Florist' | |
FoodEstablishment: 'Food Establishment' | |
FurnitureStore: 'Furniture Store' | |
GardenStore: 'Garden Store' | |
GeneralContractor: 'General Contractor' | |
GolfCourse: 'Golf Course' | |
HairSalon: 'Hair Salon' | |
HardwareStore: 'Hardware Store' | |
HealthAndBeautyBusiness: 'Health and Beauty Business' | |
HobbyShop: 'Hobby Shop' | |
HomeAndConstructionBusiness: 'Home and Construction Business' | |
HomeGoodsStore: 'Home Goods Store' | |
Hospital: 'Hospital' | |
Hotel: 'Hotel' | |
HousePainter: 'House Painter' | |
HVACBusiness: 'HVAC Business' | |
InsuranceAgency: 'Insurance Agency' | |
JewelryStore: 'Jewelry Store' | |
LiquorStore: 'Liquor Store' | |
Locksmith: 'Locksmith' | |
LodgingBusiness: 'Lodging Business' | |
MedicalClinic: 'Medical Clinic' | |
MensClothingStore: 'Mens Clothing Store' | |
MobilePhoneStore: 'Mobile PhoneStore' | |
Motel: 'Motel' | |
MotorcycleDealer: 'Motorcycle Dealer' | |
MovingCompany: 'Moving Company' | |
MusicStore: 'Music Store' | |
NailSalon: 'Nail Salon' | |
NightClub: 'Night Club' | |
Notary: 'Notary' | |
OfficeEquipmentStore: 'Office Equipment Store' | |
Optician: 'Optician' | |
PetStore: 'Pet Store' | |
Physician: 'Physician' | |
Plumber: 'Plumber' | |
ProfessionalService: 'Professional Service' | |
RealEstateAgent: 'Real Estate Agent' | |
Residence: 'Residence' | |
Restaurant: 'Restaurant' | |
RoofingContractor: 'Roofing Contractor' | |
RVPark: 'RV Park' | |
School: 'School' | |
SelfStorage: 'Self Storage' | |
ShoeStore: 'Shoe Store' | |
SkiResort: 'Ski Resort' | |
SportingGoodsStore: 'Sporting Goods Store' | |
SportsClub: 'Sports Club' | |
Store: 'Store' | |
TattooParlor: 'Tattoo Parlor' | |
Taxi: 'Taxi' | |
TennisComplex: 'Tennis Complex' | |
TireShop: 'Tire Shop' | |
ToyStore: 'Toy Store' | |
TravelAgency: 'Travel Agency' | |
VeterinaryCare: 'Veterinary Care' | |
WholesaleStore: 'Wholesale Store' | |
Winery: 'Winery' | |
comment: 'https://docs.google.com/spreadsheets/d/1Ed6RmI01rx4UdW40ciWgz2oS_Kx37_-sPi7sba_jC3w/edit#gid=0' | |
tab: 'Company Details' | |
email: | |
label: 'Primary email' | |
span: left | |
type: text | |
placeholder: 'info@domain.com' | |
comment: 'Primary email address for the company. Used around the website.' | |
tab: 'Company Details' | |
description: | |
label: 'Company description' | |
span: full | |
type: textarea | |
comment: 'Brief description for the company.' | |
tab: 'Company Details' | |
telephone_label: | |
label: 'Primary telephone' | |
span: left | |
type: text | |
placeholder: '01442 211112' | |
comment: 'Primary telephone for the company. Used around the website.' | |
tab: 'Company Details' | |
telephone_value: | |
label: 'Formatted telephone' | |
span: right | |
type: text | |
placeholder: '+44-1442-211112' | |
comment: 'Include the country code and remove the first 0 from you number. Then replace all spaces with a hypens.' | |
tab: 'Company Details' | |
logo: | |
label: 'Logo' | |
span: left | |
type: mediafinder | |
comment: 'Used for structured data in search.' | |
tab: 'Company Details' | |
image: | |
label: 'Image' | |
span: right | |
type: mediafinder | |
comment: 'Used for structured data in search. Something like office, team photo etc' | |
tab: 'Company Details' | |
streetAddress: | |
label: 'Street Address' | |
span: left | |
type: text | |
tab: 'Address' | |
addressLocality: | |
label: 'City' | |
span: left | |
type: text | |
tab: 'Address' | |
addressRegion: | |
label: 'County' | |
span: left | |
type: text | |
tab: 'Address' | |
postalCode: | |
label: 'Post code' | |
span: left | |
type: text | |
tab: 'Address' | |
addressCountry: | |
label: 'Country' | |
span: left | |
type: text | |
tab: 'Address' | |
contact_points: | |
label: 'Company Name' | |
span: full | |
type: repeater | |
form: | |
fields: | |
telephone_label: | |
label: 'Telephone' | |
span: left | |
type: text | |
required: 1 | |
placeholder: '01442 211112' | |
comment: 'Primary telephone for the company. Used around the website.' | |
telephone_value: | |
label: 'Formatted telephone' | |
span: right | |
type: text | |
required: 1 | |
placeholder: '+44-1442-211112' | |
comment: 'Include the country code and remove the first 0 from you number. Then replace all spaces with a hypens.' | |
contactType: | |
label: 'Contact type' | |
span: right | |
type: dropdown | |
required: 1 | |
options: | |
customer support: 'Customer support' | |
technical support: 'Technical support' | |
billing support: 'Billing support' | |
bill payment: 'Bill payment' | |
sales: 'Sales' | |
reservations: 'Reservations' | |
credit card support: 'Credit card support' | |
emergency: 'Emergency' | |
baggage tracking: 'Baggage tracking' | |
roadside assistance: 'Roadside assistance' | |
package tracking: 'Package tracking' | |
areaServed: | |
label: 'Area served' | |
span: left | |
type: text | |
placeholder: 'GB,US' | |
comment: 'Countries may be specified concisely using just their standard ISO-3166 two-letter code. Separate multiple countries with a comma.' | |
contactOption: | |
label: 'Contact option' | |
span: right | |
type: dropdown | |
options: | |
null: '-- optional --' | |
TollFree: 'Toll Free' | |
HearingImpairedSupported: 'Hearing Impaired Supported' | |
availableLanguage: | |
label: 'Available language' | |
span: left | |
type: text | |
placeholder: 'English, Spanish' | |
comment: 'Details about the language spoken. Languages may be specified by their common English name. If omitted, the language defaults to English. Separate multiple languages with a comma.' | |
tab: 'Contact points' | |
mon_open: | |
label: 'Monday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
mon_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: mon_open | |
condition: checked | |
mon_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: mon_open | |
condition: checked | |
tue_open: | |
label: 'Tuesday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
tue_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: tue_open | |
condition: checked | |
tue_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: tue_open | |
condition: checked | |
wed_open: | |
label: 'Wednesday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
wed_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: wed_open | |
condition: checked | |
wed_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: wed_open | |
condition: checked | |
thu_open: | |
label: 'Thursday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
thu_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: thu_open | |
condition: checked | |
thu_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: thu_open | |
condition: checked | |
fri_open: | |
label: 'Friday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
fri_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: fri_open | |
condition: checked | |
fri_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: fri_open | |
condition: checked | |
sat_open: | |
label: 'Saturday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
sat_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: sat_open | |
condition: checked | |
sat_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: sat_open | |
condition: checked | |
sun_open: | |
label: 'Sunday' | |
span: left | |
type: checkbox | |
tab: 'Opening Hours' | |
sun_opens: | |
span: left | |
type: text | |
comment: 'Opening time.' | |
tab: 'Opening Hours' | |
placeholder: '9:00' | |
trigger: | |
action: show | |
field: sun_open | |
condition: checked | |
sun_closes: | |
span: right | |
type: text | |
comment: 'Closing time.' | |
tab: 'Opening Hours' | |
placeholder: '17:30' | |
trigger: | |
action: show | |
field: sun_open | |
condition: checked | |
latitude: | |
label: 'Latitude' | |
span: left | |
type: text | |
placeholder: '51.681791' | |
tab: 'Geo location' | |
longitude: | |
label: 'Longitude' | |
span: right | |
type: text | |
placeholder: '-0.002870' | |
tab: 'Geo location' | |
facebook: | |
label: "Facebook" | |
span: left | |
type: text | |
placeholder: 'https://www.facebook.com/CommotionCo' | |
tab: 'Social Profiles' | |
twitter: | |
label: "Twitter" | |
span: left | |
type: text | |
placeholder: 'https://twitter.com/CommotionCo' | |
tab: 'Social Profiles' | |
googleplus: | |
label: "Google+" | |
span: left | |
type: text | |
placeholder: 'https://plus.google.com/u/0/b/103790837691668729570/+CommotionCo' | |
tab: 'Social Profiles' | |
youtube: | |
label: "YouTube" | |
span: left | |
type: text | |
placeholder: 'https://www.youtube.com/channel/UCGqBUNvwObcaii97iFAObew' | |
tab: 'Social Profiles' | |
linkedin: | |
label: "LinkedIn" | |
span: left | |
type: text | |
placeholder: 'https://www.linkedin.com/company/commotion-creative-limited' | |
tab: 'Social Profiles' | |
instagram: | |
label: "Instagram" | |
span: left | |
type: text | |
placeholder: 'https://www.instagram.com/username' | |
tab: 'Social Profiles' | |
pinterest: | |
label: "Pinterest" | |
span: left | |
type: text | |
placeholder: 'https://uk.pinterest.com/commotionco/' | |
tab: 'Social Profiles' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment