Skip to content

Dynamic date SEO query #151

@marcusforsberg

Description

@marcusforsberg

#148 introduced the ability to query date archive settings, which works well.

However, is there any way to add a dynamic query for this where you can specify a specific date? In the Yoast Settings, you can add a "Date" variable which is normally replaced with the actual date. Being able to utilize that variable in GraphQL would be quite powerful.

Consider a date archive setup such as this:

Screen Shot 2023-02-16 at 4 43 56 PM

The query would return:

"seo": {
  "meta": {
    "date": {
      "description": "",
      "title": "Posts from: - my-site"
    }
  }
}

There's no way for the client to know where to inject the date since the "date" variable has been stripped away.

Would it be possible to implement a custom query type such as this (with month and day being optional)?

query GET_DATE_ARCHIVE_SEO {
  dateSeo(year: 2023, month: 2, day: 16) {
    description
        title
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions