├── .gitignore ├── FUNDING.yml ├── LICENSE ├── README.md ├── config.yaml ├── data ├── .gitkeep ├── location │ └── enschede.json └── team │ └── martijn.json ├── layouts └── partials │ └── schemas │ ├── schema_AggregateRating.html │ ├── schema_Article.html │ ├── schema_BlogPosting.html │ ├── schema_BreadcrumbList.html │ ├── schema_Course.html │ ├── schema_Dataset.html │ ├── schema_Global.html │ ├── schema_JobPosting.html │ ├── schema_LocalBusiness.html │ ├── schema_LocalBusiness_Legal.html │ ├── schema_LocalBusiness_Notary.html │ ├── schema_LocalBusiness_Store.html │ ├── schema_Person.html │ ├── schema_Question_Answers.html │ ├── schema_Service.html │ ├── schema_ServiceArea.html │ ├── schema_SiteNavigationElement.html │ ├── schema_Social.html │ ├── schema_SpeakableSpecification.html │ ├── schema_VideoObject.html │ ├── schema_ViewAction.html │ ├── schema_WPHeader.html │ └── schema_WebSite.html └── theme.toml /.gitignore: -------------------------------------------------------------------------------- 1 | # Hugo default output directory 2 | /public 3 | 4 | ## OS Files 5 | # Windows 6 | Thumbs.db 7 | ehthumbs.db 8 | Desktop.ini 9 | $RECYCLE.BIN/ 10 | 11 | # OSX 12 | .DS_Store 13 | 14 | .sass-cache 15 | 16 | # IDE config. 17 | .idea -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: Baseflow 2 | custom: https://baseflow.com/contact 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Martijn van Dijk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HugoStructuredData 2 | Collection of structured data snippets in Google preferred JSON-LD format, with support for Hugo. 3 | 4 | Based on the work of: https://github.com/JayHoltslander/Structured-Data-JSON-LD 5 | 6 | This uses the [Hugo pipelines](https://gohugo.io/themes/theme-components/) introduced in [Hugo 0.42](https://gohugo.io/news/0.42-relnotes/) 7 | 8 | # Support 9 | 10 | * Feel free to open an issue. Make sure to use one of the templates! 11 | * Commercial support is available. Integration with your app or services, samples, feature request, etc. Email: [hello@baseflow.com](mailto:hello@baseflow.com) 12 | * Powered by: [baseflow.com](https://baseflow.com) 13 | 14 | # Usage 15 | 16 | Start by adding this theme to your website in the config file: 17 | 18 | ``` 19 | theme: 20 | - your-own-theme 21 | - structured-data 22 | - some-other-theme 23 | ``` 24 | 25 | Change the properties inside `themes/structured-data/config.yaml` to match you details. 26 | 27 | Add this snippet to the `
` of your baseof.html 28 | 29 | `{{ partial "schemas/schema_Global.html" . }}` 30 | 31 | Add `contenttypes` to the parameters of the pages you would like to include the schemes in. 32 | 33 | ``` 34 | --- 35 | title: "Some person" 36 | date: 2018-03-28T21:58:30+02:00 37 | contenttypes: ["Person"] 38 | --- 39 | ``` 40 | 41 | Or another example 42 | 43 | ``` 44 | --- 45 | title: "This is a blog and article" 46 | date: 2018-03-28T21:58:30+02:00 47 | contenttypes: ["BlogPosting, "Article"] 48 | --- 49 | ``` 50 | 51 | Other available properties are: 52 | 53 | ``` 54 | --- 55 | type: blog 56 | layout: post 57 | title: "Introducing blog" 58 | date: 2018-06-01T16:40:55+01:00 59 | author: notmartijn 60 | contenttypes: ["BlogPosting"] 61 | --- 62 | ``` 63 | 64 | In this case the author of the file will be `notmartijn` instead of the default author `martijn`. 65 | 66 | To add, change or remove locations or authors look in the data folder. 67 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | params: 2 | color: "#000000" 3 | name: "YourName" # your company name 4 | contact: "hello@yourname.com" # Primary email address 5 | phone: "0123345678" # Primary phone 6 | copyright: "© 2018 YourName. All rights reserved." 7 | description: "YourName" # Add a short description 8 | logourl: "images/logo.png" # Used in structured data as logo url 9 | imageurl: "images/bg.jpg" # Used in structured data as background image 10 | pricerange: "$$" # Used in structured data as price range 11 | primarylocation: "enschede" # Used as primary location if no specific is set 12 | primaryauthor: "martijn" # Used as primary author if no specific is set 13 | keywords: ["mobile", "web", "ai", "backend", "open source"] # Can be overriden per page 14 | social: 15 | website: "https://baseflow.com" 16 | github: "BaseflowIT" 17 | facebook: "BaseflowIT" 18 | facebook_admin: "1111111" # This needs to be a page admin to get domain insights 19 | twitter: "BaseflowIT" 20 | twitter_domain: "baseflow.com" # This domain shows in twitter cards as "View on `twitter_domain`" 21 | googleplus: "BaseflowIT" 22 | pinterest: "BaseflowIT" 23 | instagram: "BaseflowIT" 24 | youtube: "BaseflowIT" 25 | linkedin: "BaseflowIT" 26 | images: 27 | ["images/bg.jpg"] # For twitter cards -------------------------------------------------------------------------------- /data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/HugoStructuredData/711c99b4414b369fc589ee0e7b2acd61614b9111/data/.gitkeep -------------------------------------------------------------------------------- /data/location/enschede.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Enschede", 3 | "thumbnail": "/company/location/enschede/enschede.jpg", 4 | "email": "hello@baseflow.com", 5 | "phone": "+31532032429", 6 | "address": { 7 | "street": "Gronausestraat 710", 8 | "city": "Enschede", 9 | "region": "Overijsel", 10 | "country": "Netherlands", 11 | "postalcode": "7534 AM" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /data/team/martijn.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Martijn van Dijk", 3 | "thumbnail": "/company/team/martijn/martijn.png", 4 | "email": "martijn@baseflow.com", 5 | "gender": "male", 6 | "nationality": "Dutch", 7 | "social": { 8 | "github": "martijn00", 9 | "twitter": "mhvdijk", 10 | "instagram": "martijn00", 11 | "linkedin": "martijn-van-dijk" 12 | } 13 | } -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_AggregateRating.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Article.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 43 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_BlogPosting.html: -------------------------------------------------------------------------------- 1 | {{ $location := index .Site.Data.location .Site.Params.primarylocation }} 2 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_BreadcrumbList.html: -------------------------------------------------------------------------------- 1 | {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} 2 | {{ $.Scratch.Delete "path" }} 3 | {{ $.Scratch.Add "path" .Site.BaseURL }} 4 | {{ $count := len (split $url "/") }} 5 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Course.html: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Dataset.html: -------------------------------------------------------------------------------- 1 | 52 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Global.html: -------------------------------------------------------------------------------- 1 | {{ if .IsHome -}} 2 | {{ partial "schemas/schema_WebSite.html" . }} 3 | {{- else if .IsPage -}} 4 | 5 | {{ if or (in .Params.contenttypes "AggregateRating") }} 6 | {{ partial "schemas/schema_AggregateRating.html" . }} 7 | {{ end }} 8 | 9 | {{ if or (eq .Type "article") (in .Params.contenttypes "Article") }} 10 | {{ partial "schemas/schema_Article.html" . }} 11 | {{ end }} 12 | 13 | {{ if or (eq .Type "blog") (in .Params.contenttypes "BlogPosting") }} 14 | {{ partial "schemas/schema_BlogPosting.html" . }} 15 | {{ end }} 16 | 17 | {{ if or (in .Params.contenttypes "BreadcrumbList") }} 18 | {{ partial "schemas/schema_BreadcrumbList.html" . }} 19 | {{ end }} 20 | 21 | {{ if or (in .Params.contenttypes "Course") }} 22 | {{ partial "schemas/schema_Course.html" . }} 23 | {{ end }} 24 | 25 | {{ if or (in .Params.contenttypes "JobPosting") }} 26 | {{ partial "schemas/schema_JobPosting.html" . }} 27 | {{ end }} 28 | 29 | {{ if or (in .Params.contenttypes "LocalBusiness") }} 30 | {{ partial "schemas/schema_LocalBusiness.html" . }} 31 | {{ end }} 32 | 33 | {{ if or (in .Params.contenttypes "LocalBusiness_Legal") }} 34 | {{ partial "schemas/schema_LocalBusiness_Legal.html" . }} 35 | {{ end }} 36 | 37 | {{ if or (in .Params.contenttypes "LocalBusiness_Notary") }} 38 | {{ partial "schemas/schema_LocalBusiness_Notary.html" . }} 39 | {{ end }} 40 | 41 | {{ if or (in .Params.contenttypes "LocalBusiness_Store") }} 42 | {{ partial "schemas/schema_LocalBusiness_Store.html" . }} 43 | {{ end }} 44 | 45 | {{ if or (in .Params.contenttypes "Person") }} 46 | {{ partial "schemas/schema_Person.html" . }} 47 | {{ end }} 48 | 49 | {{ if or (in .Params.contenttypes "QuestionAnswers") }} 50 | {{ partial "schemas/schema_Question_Answers.html" . }} 51 | {{ end }} 52 | 53 | {{ if or (in .Params.contenttypes "Service") }} 54 | {{ partial "schemas/schema_Service.html" . }} 55 | {{ end }} 56 | 57 | {{ if or (in .Params.contenttypes "ServiceArea") }} 58 | {{ partial "schemas/schema_ServiceArea.html" . }} 59 | {{ end }} 60 | 61 | {{ if or (in .Params.contenttypes "SiteNavigationElement") }} 62 | {{ partial "schemas/schema_SiteNavigationElement.html" . }} 63 | {{ end }} 64 | 65 | {{ if or (in .Params.contenttypes "SpeakableSpecification") }} 66 | {{ partial "schemas/schema_SpeakableSpecification.html" . }} 67 | {{ end }} 68 | 69 | {{ if or (in .Params.contenttypes "VideoObject") }} 70 | {{ partial "schemas/schema_VideoObject.html" . }} 71 | {{ end }} 72 | 73 | {{ if or (in .Params.contenttypes "ViewAction") }} 74 | {{ partial "schemas/schema_ViewAction.html" . }} 75 | {{ end }} 76 | 77 | {{ if or (in .Params.contenttypes "Website") }} 78 | {{ partial "schemas/schema_WebSite.html" . }} 79 | {{ end }} 80 | 81 | {{ if or (in .Params.contenttypes "WPHeader") }} 82 | {{ partial "schemas/schema_WPHeader.html" . }} 83 | {{ end }} 84 | 85 | {{- end }} -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_JobPosting.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 57 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_LocalBusiness.html: -------------------------------------------------------------------------------- 1 | {{ if isset .Params "location" }}{{ $location := index .Site.Data.location .Params.location }} 2 | 45 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_LocalBusiness_Legal.html: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_LocalBusiness_Notary.html: -------------------------------------------------------------------------------- 1 | 218 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_LocalBusiness_Store.html: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Person.html: -------------------------------------------------------------------------------- 1 | {{ if isset .Params "author" }} 2 | {{ $author := index .Site.Data.team .Params.author }} 3 | {{ $location := index .Site.Data.location .Site.Params.primarylocation }} 4 | 64 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Question_Answers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 56 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Service.html: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_ServiceArea.html: -------------------------------------------------------------------------------- 1 | {{ if isset .Params "location" }}{{ $location := index .Site.Data.locations .Params.location }} 2 | 32 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_SiteNavigationElement.html: -------------------------------------------------------------------------------- 1 | {{ $baseUrl := .Site.BaseURL }} 2 | 19 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_Social.html: -------------------------------------------------------------------------------- 1 | 2 | {{ if .social }} 3 | {{ if .social.twitter }}"https://twitter.com/{{ .social.twitter }}",{{ end }} 4 | {{ if .social.pinterest }}"https://pinterest.com/{{ .social.pinterest }}",{{ end }} 5 | {{ if .social.instagram }}"https://instagram.com/{{ .social.instagram }}",{{ end }} 6 | {{ if .social.facebook }}"https://www.facebook.com/{{ .social.facebook }}",{{ end }} 7 | {{ if .social.linkedin }}"https://ca.linkedin.com/in/{{ .social.linkedin }}/en",{{ end }} 8 | {{ if .social.googleplus }}"https://plus.google.com/+{{ .social.googleplus }}",{{ end }} 9 | {{ if .social.youtube }}"https://www.youtube.com/user/{{ .social.youtube }}",{{ end }} 10 | {{ if .social.github }}"https://github.com/{{ .social.github }}",{{ end }} 11 | {{ if .social.wordpress }}"https://profiles.wordpress.org/{{ .social.wordpress }}",{{ end }} 12 | {{ if .social.angel }}"https://angel.co/{{ .social.angel }}",{{ end }} 13 | {{ if .social.foursquare }}"https://www.foursquare.com/user/{{ .social.foursquare }}",{{ end }} 14 | {{ if .social.yelp }}"https://{{ .social.yelp }}.yelp.ca",{{ end }} 15 | {{ if .social.codepen }}"https://codepen.io/{{ .social.codepen }}/",{{ end }} 16 | {{ if .social.stackoverflow }}"https://stackoverflow.com/users/{{ .social.stackoverflow }}",{{ end }} 17 | {{ if .social.dribbble }}"https://dribbble.com/{{ .social.dribbble }}",{{ end }} 18 | {{ if .social.deviantart }}"http://{{ .social.deviantart }}.deviantart.com/",{{ end }} 19 | {{ if .social.behance }}"https://www.behance.net/{{ .social.behance }}",{{ end }} 20 | {{ if .social.flickr }}"https://www.flickr.com/people/{{ .social.flickr }}/",{{ end }} 21 | {{ if .social.medium }}"https://medium.com/@{{ .social.medium }}",{{ end }} 22 | {{ if .social.website }}"{{ .social.website }}"{{ else }}"{{ .Site.Params.social.website }}"{{ end }} 23 | {{ end }} -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_SpeakableSpecification.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 |The law society's rules prevent lawyers from making superlative claims such as that they are best lawyer. So read these testimonials below instead.
16 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_VideoObject.html: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_ViewAction.html: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_WPHeader.html: -------------------------------------------------------------------------------- 1 | {{ $baseUrl := .Site.BaseURL }} 2 | 31 | -------------------------------------------------------------------------------- /layouts/partials/schemas/schema_WebSite.html: -------------------------------------------------------------------------------- 1 | {{ $baseUrl := .Site.BaseURL }} 2 | {{ $location := index .Site.Data.location .Site.Params.primarylocation }} 3 | -------------------------------------------------------------------------------- /theme.toml: -------------------------------------------------------------------------------- 1 | # theme.toml template for a Hugo theme 2 | # See https://github.com/gohugoio/hugoThemes#themetoml for an example 3 | 4 | name = "Structured Data" 5 | license = "MIT" 6 | licenselink = "https://github.com/martijn00/HugoStructuredData/blob/master/LICENSE" 7 | description = "Adds structured data to your website to improve SEO" 8 | homepage = "http://baseflow.com/" 9 | tags = ["SEO"] 10 | features = [] 11 | min_version = "0.42" 12 | 13 | [author] 14 | name = "Martijn00" 15 | homepage = "http://baseflow.com/" 16 | 17 | # If porting an existing theme 18 | [original] 19 | name = "" 20 | homepage = "" 21 | repo = "" 22 | --------------------------------------------------------------------------------