web.dev icon indicating copy to clipboard operation
web.dev copied to clipboard

Conclusion page [Learn Css]: name of contributors are not rendering.

Open amitkrgupta094 opened this issue 5 years ago • 5 comments

Describe the bug Name of contributors are not rendering.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://web.dev/learn/css/conclusion/
  2. Scroll down to 'Brought to you by #'
  3. Check contributors name "undefined undefined"

Expected behavior Contributors name should be there.

Screenshots bug

amitkrgupta094 avatar Jul 14 '21 08:07 amitkrgupta094

I did a {{ author | dump }} from author-stack.njk to see if the name property existed in the author object since it was being depended on here:

{%- set authorName = author.name.given + ' ' + author.name.family -%}

and as expected the author.name property wasn't defined which explains the "undefined undefined" because both author.name.given and author.name.family aren't defined in author.

Here is the first author object from set author = authorData[item]

{"homepage":"https://piccalil.li/","github":"andy-piccalilli","twitter":"piccalilli_","image":"image/foR0vJZKULb5AGJExlazy1xYDgI2/KgpVYUM3YJiVTASm4RTB.jpeg"}

as we can see the name or description properties don't exist in author.

The collection being iterated over {% for item in authors %} is authors.js and each item is the twitter | github handle text ie "rachelandrew", "jiwoong" etc. The authorData is a global data file in _data but the name property is not defined, so it must have been dynamically added elsewhere or hardcoded if this conclusion page and author-stack.njk relied on those key/value pairs.

Screen Shot 2021-07-15 at 3 20 24 AM

tannerdolby avatar Jul 15 '21 10:07 tannerdolby

I'm not entirely sure if the name and description are coming from eleventyComputed (actually couldn't find with git grep -n "name: ") anything the defined a name property. The description and underlying author object

/** @type AuthorsItem */
    const author = {
      ...authorData,
      data: {
        date,
        hero: image,
        updated,
      },
      description: `i18n.authors.${key}.description`,
      elements,
      href,
      image,
      key,
      title: `i18n.authors.${key}.title`,
      url: href,
    };

seems to have all the stuff we need, but still a bit perplexed why the name and description have dissapeared when we iterate over the collection in author-stack.njk. From what I read in #5657, it seems the i18n.authors.${key}.title is what supplies the title, and the underlying data is stored in src/site/i18n/authors.yml

jakearchibald:
  title:
    en: Jake Archibald
  description:
    en: Human boy working on web standards at Google

This is what I've been wanting to find, both the author name and description are available so we need to update author-stack.njk to use the appropriate values since author.name.given isn't available.

tannerdolby avatar Jul 15 '21 18:07 tannerdolby

Now that #5823 has landed, I reckon this is ready to be closed as well @MichaelSolati

tannerdolby avatar Jul 16 '21 22:07 tannerdolby

I agree, and thank you for being so I'm top of this! And all the other related issues 😁

MichaelSolati avatar Jul 16 '21 22:07 MichaelSolati

Your welcome! I'm glad to help 🎉

tannerdolby avatar Jul 17 '21 02:07 tannerdolby