Skip to content

Lume Relations does not work? #309

Discussion options

You must be logged in to vote

In your first example:

site.use(
relations({
  foreignKeys: {
    article: "article_id",
    author: "author",
  }
}));

The problem is author key and value cannot be equal, because the plugin creates a new author property that overrides your author value. The id can be anything, it's not limited to integers. Probably something like this should work:

site.use(
relations({
  foreignKeys: {
    article: "article_id",
    author: "authorName",
  }
}));

If you don't want to use the id field to link the pages, you can change it to any other value, but note that this will affect to all relations (cannot be configured individually per relation). Example:

site.use(
relations({
  idKey: "slug",
  f…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@oscarotero
Comment options

@officialrajdeepsingh
Comment options

Answer selected by officialrajdeepsingh
Comment options

You must be logged in to vote
1 reply
@oscarotero
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants