Get started with creativecommons-vocabulary CDN

MIT licensed

Creative Commons library identifies, interprets applied licenses to online content.

Tags:
  • ui
  • ux
  • design
  • design system
  • components
  • sass stylesheets
  • library
  • monorepo

Stable version

Copied!

How to start using creativecommons-vocabulary CDN


<!DOCTYPE html>
<html>
<head>
  <meta name="description" content="An example of using Creative Commons Vocabulary.">
  <title>Get started with creativecommons-vocabulary CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/creativecommons-vocabulary/2020.11.3/js/vocabulary.js" defer></script>
  <script>
    // Assuming you have an element with id 'licenseInfo' where you want to display the license info
    const licenseInfo = document.getElementById('licenseInfo');

    // Define the work metadata
    const work = {
      creator: {
        name: 'John Doe',
      },
      title: 'Example Work',
      description: 'This is an example work.',
      license: {
        type: 'CC0', // CC0, CC BY, CC BY-SA, CC BY-ND, CC BY-NC, CC BY-NC-SA, CC BY-NC-ND
        version: '1.0',
      },
    };

    // Get the license object using the CCV
    ccVocab.getLicense(work.license.type, work.license.version)
      .then((license) => {
        // Display the license info
        licenseInfo.innerHTML = `
          <p><strong>License:</strong> ${license.name.value}</p>
          <p><strong>URL:</strong> ${license.url}</p>
          <p><strong>Machine-readable:</strong> ${license.machineReadable.value}</p>
        `;
      })
      .catch((error) => {
        console.error('Error getting the license:', error);
      });
  </script>
</head>
<body>
  <div id="licenseInfo"></div>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions