Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bkwld/json-ld-formatters

Package Overview
Dependencies
Maintainers
7
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bkwld/json-ld-formatters

A library of helper functions for creating common JSON LD schemas.

  • 0.7.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
35
decreased by-2.78%
Maintainers
7
Weekly downloads
 
Created
Source

json-ld-formatters

A library of helper functions for creating common JSON LD schemas. These are intended to be used in Nuxt.js projects.

Install

yarn add @bkwld/json-ld-formatters

Example

Here's how you would use this in a typical Cloak page component.

<!-- pages/_article.vue -->
<script lang='coffee'>
import pageMixin from '@bkwld/cloak/mixins/page'
import { makeJsonLdArticleTag } from '@bkwld/json-ld-formatters'
export default

	# Add Cloak's pageMixin to the example.  This isn't necessary, but I think
	# it useful to show how you would use @buildHead to mash up other meta / SEO
	# data with this
	mixins: [ pageMixin ]

	# Here's where the use the formatter
	head: -> {
		...@buildHead
			title: @page.marqueeTitle
		script: [ makeJsonLdArticleTag
			title: @page.marqueeTitle
			image: @page.image
			publishedAt: new Date @page.dateCreated
			updatedAt: new Date @page.dateUpdated
			author: 'Bukwild'
		]
	}

	# Showing an example of fetching page data
	asyncData: ({ app, route }) ->
		page = await app.$service.getPageData route.params.article
		return { page }

</script>

Formatters

Read the source code for the available formatters and their expected properties.

  • article - makeJsonLdArticleTag
  • breadcrumbs - makeJsonLdBreadcrumbsTag
  • faqPage - makeJsonLdFAQPageTag
  • organization - makeJsonLdOrganizationTag
  • product makeJsonLdProductTag
  • search - makeJsonLdSearchTag

FAQs

Package last updated on 20 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc