Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add url property to tests #18

Open
iaincollins opened this issue Mar 14, 2020 · 1 comment
Open

Add url property to tests #18

iaincollins opened this issue Mar 14, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request pre-release Issues that do not impact the live version, only the pre-release version
Milestone

Comments

@iaincollins
Copy link
Owner

Summary of proposed feature
Add url property to tests and presets that can be used to link to documentation, and display the the URL in the CLI when a test does not pass (ie on error or warning).

Purpose of proposed feature
Provide a way to reference online documentation to resolve issues, especially when a test fails.

Detail of the proposed feature

  • If defined on a preset, the url property for a preset should be displayed in the console under the preset name.
  • If defined on a test, the url property should be displayed under the name of the property if the test does not pass (ie on error or warning).

This property should link to pages that document a schema and/or can help resolve the specific problem. It would work well with the new schema.org property tests (which are in master but not in the release version).

Potential problems
None.

Describe any alternatives you've considered
None.

Additional context
URL properties for Schema objects could also be automatically generated.

@iaincollins iaincollins added the enhancement New feature or request label Mar 14, 2020
@iaincollins iaincollins added this to the Version 5.0 milestone Mar 14, 2020
@iaincollins iaincollins added the pre-release Issues that do not impact the live version, only the pre-release version label Mar 14, 2020
@iaincollins iaincollins added the documentation Improvements or additions to documentation label Mar 14, 2020
@iaincollins
Copy link
Owner Author

This feature has been added but not yet documented, this issue should remain open until it is.

URLs can be specified on both presets and tests, like this:

const Twitter = {
  name: 'Twitter',
  description: 'Suggested metatags for Twitter',
  url: 'https://developer.twitter.com/en/docs/tweets/optimize-with-cards',
  tests: [
    { test: `"twitter:card"`, type: 'metatag', description: 'must have card type' },
    { test: `"twitter:title"`, type: 'metatag', description: 'must have title' },
    { test: `"twitter:description"`, type: 'metatag', description: 'must have description' },
    { test: `"twitter:image" || "twitter:image:src"`, type: 'metatag', description: 'must have image url' },
    { test: `"twitter:image:alt"`, type: 'metatag', description: 'must have image alt text' },
    { test: `"twitter:site"`, type: 'metatag', warning: true, description: 'should have account username' },
    { test: `"twitter:creator"`, type: 'metatag', warning: true, description: 'should have username of content creator' },
  ],
}

It is currently only really used internally by the CLI (although 'url' objects are exposed via the API too) but is worth documenting - especially if/when the CLI is able to use custom presets.

NB: If a test (or preset that is part of another preset) does not have a URL, but a parent preset does, then they will inherit the URL property from the nearest parent preset, this is so that you can specify a URL once for multiple tests, while still being able to link to more specific documentation for any given test.

@iaincollins iaincollins reopened this Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request pre-release Issues that do not impact the live version, only the pre-release version
Projects
None yet
Development

No branches or pull requests

1 participant