Lume Relations does not work? #309
-
When I use the following code on my website, it doesn't show anything. site.use(
relations({
foreignKeys: {
article: "article_id",
author: "author", // replace to the author_id
}
})); In my posts, I already mention the author meta tag. ---
# posts/the-millionaire-guide-on-programing-to-help-you-get-rich.md
title: The Millionaire Guide On Programming To Help You Get Rich.
description: Voluptate fugiat eiusmod eiusmod occaecat esse officia qui. Elit elit velit
cillum eiusmod aliquip ullamco exercitation sin.
date: 2022-11-08T08:26:45.204Z
draft: false
tags:
- Millionaire
- Programming
- Rich
category:
- Programming
image: /images/computer.jpg
author: Jeffery Schwartz
slug: millionaire-guide-programing-rich
---
Mollit enim excepteur rest of article ..... In my authors, I already mention the author meta tag. # authors/annie-dean.md
---
author: Annie Dean
description: Sit culpa elit excepteur ea Lorem ullamco eiusmod ex ut ea incididunt minim. Cillum eiusmod fugiat cupidatat.
date: 2022-11-08T09:01:53.077Z
draft: false
image: "/images/female1.jpg"
social:
- facebook.com
- Google.com
job : "Writer"
---
Sit culpa elit excepteur ea rest articles.... With site.use(
relations({
foreignKeys: {
article: "article_id",
author: "article_id",
}
})); The relations foreign Keys only accept the integer value as an id? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
In your first example: site.use(
relations({
foreignKeys: {
article: "article_id",
author: "author",
}
})); The problem is site.use(
relations({
foreignKeys: {
article: "article_id",
author: "authorName",
}
})); If you don't want to use the site.use(
relations({
idKey: "slug",
foreignKeys: {
article: "article_slug",
author: "author_slug",
}
})); In this example, I've configured the |
Beta Was this translation helpful? Give feedback.
-
Sorry I can use the following ways to add a relationship with the article and author. But it is not working. site.use(
relations({
foreignKeys: {
article: "article_id",
author: "author_name",
}
})); # posts/5-reasons-why-you-shouldn't-learn-photography-on-your-own.
# type="posts"
---
title: 5 Reasons Why You Shouldn't Learn Photography On Your Own.
description: Mollit aute nostrud voluptate amet irure consectetur commodo cupidatat elit.
Non ut dolor nulla dolor duis. Anim eiusmod fugiat eiusmod ut nulla nulla
labore.
date: 2022-11-08T08:18:10.494Z
draft: false
tags:
- Photography
- Learn Photography
category:
- Photography
image: /images/camera.jpg
author_name: Jeanne Ballard
---
rest article here ...
# author
# type="author"
---
author_name: Jeanne Ballard
description: Sit culpa elit excepteur ea Lorem ullamco eiusmod ex ut ea incididunt minim. Cillum eiusmod fugiat cupidatat.
date: 2022-11-08T09:01:53.077Z
draft: false
image: "/images/female1.jpg"
social:
- facebook.com
- Google.com
job : "Writer"
--- |
Beta Was this translation helpful? Give feedback.
In your first example:
The problem is
author
key and value cannot be equal, because the plugin creates a newauthor
property that overrides yourauthor
value. The id can be anything, it's not limited to integers. Probably something like this should work: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: