In this page

    Other SSGs > Link fields

    Link fields

    Suppose our blog_post model has the following fields:

    • author: Single link referencing a user record;

    • related_posts: Multiple links referencing other blog_post records;

    In this case, will return the linked user record (or null, if the relation is empty), and blog_post.related will return an array of blog_post records.

    // dato.config.js
    module.exports = (dato, root, i18n) => {
    dato.blogPosts[0].author.fullName; // => "Mark Smith"
    dato.blogPosts[0].related.forEach(relatedPost => {
    relatedPost.title; // => "Another post!"

    Use method chains to navigate deeply across your records' relationships:

    // dato.config.js
    module.exports = (dato, root, i18n) => {
    dato.blogPosts[0].related[0] // => "Tom Kepler"

    Reverse lookups

    You can easily find all the blog post for a specific author with this Javascript one-liner:

    // dato.config.js
    module.exports = (dato, root, i18n) => {
    const peter = dato.find("1413");
    dato.blogPosts.filter(blogPost => ===;
    We use cookies to enhance the user experience. Do you consent their use in accordance with our cookie policy?