What are entities?

In the docs I can read things such as…

https://docs.frontity.org/frontity-plugins/rest-api-head-tags#entities-with-head-tags

The plugin has been developed to include the head_tags field to the REST API response of most of the WordPress core entities…

https://docs.frontity.org/api-reference-1/wordpress-source#source-fetch

This action fetches all entities related to a link , i.e. the pathname of a URL in your site.

https://docs.frontity.org/api-reference-1/frontity#decode

An entity decoder that decodes HTML numeric entities and XML named entities. It works both in the server and the client and it’s optimized to be both lightweight and performant.

… and specifically here we can read…

Let’s start by explaining how the state data is used and then how that data is requested and stored. The state works with two main concepts: links and entities .

What are exactly entities?

We are calling entities to the individual items that people can create in WordPress, like posts, pages, taxonomies and so on. So mainly the items that come from the REST API and we then store in state.source.post, state.source.page, state.source.category, state.source.tag and so on.

There’s no name for that in WordPress, so we had to make our own.

The only place where it’s not consistent it’s on the only place where it is exposed:

const data = state.source.get(state.router.link);
data.items; // <- This should have been data.entities.

I was thinking about changing it, while preserving backward compatibility.

This is different, it refers to HTML entities.


Does it make sense? :slightly_smiling_face:

1 Like