Query by Tag

This page gives you a couple of examples of how to query documents by their tags. If you want to query all of the documents with a certain tag, then you just need to specify the document.tags.

Before reading

This page assumes that you're using the Vue.js starter project or that you have setup your project as explained on the Integrating with existing project page.

Query by a Certain Tag

Here is an example of a query of all the documents with the tag "Featured".

Copy
this.$prismic.client.query(
  this.$prismic.Predicates.at('document.tags', ['Featured'])
).then((response) => {
  // response is the response object, response.results holds the documents
});

Query all of Multiple Tags

This example shows how to query all of the documents with either the tag "Tag 1" or "Tag 2" by using the any predicate.

Copy
this.$prismic.client.query(
  this.$prismic.Predicates.any('document.tags', ['Tag 1', 'Tag 2'])
).then((response) => {
  // response is the response object, response.results holds the documents
});