Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple authors per blog #298

Open
1 task done
shift16 opened this issue Jan 14, 2025 · 7 comments · May be fixed by #303
Open
1 task done

Multiple authors per blog #298

shift16 opened this issue Jan 14, 2025 · 7 comments · May be fixed by #303
Labels
enhancement New feature or request

Comments

@shift16
Copy link

shift16 commented Jan 14, 2025

Checks

Link to your website repo

https://github.com/NSFThinIce/ThinIceProject

Version of Lab Website Template you are using

v1.3.2

Description

Add the ability to add multiple authors to one blog post

@shift16
Copy link
Author

shift16 commented Jan 14, 2025

---
title: A title
authors: john-doe, jane-doe # This should result in two users being shown
tags:
  - biology
  - medicine
  - big data
---

Changing how the author field is parsed might break some older pages. I believe it would be better to add another field called 'authors'. This would preserve the existing functionality of the author field, and also makes more sense.

@vincerubinetti
Copy link
Collaborator

I'm not sure how many other people would want this so I don't know if I'd add it to the template.

I'll reply later with a simple modification to the components that could support this. To really support it well, more modifications would be needed to make sure things still look okay and are usable if the user were to add more than like 2 extra authors.

@shift16
Copy link
Author

shift16 commented Jan 15, 2025

Sorry for complicating things. The only functionality that I would want would be the ability to click on the names displayed and have them redirect to the users profile. For instance, in the below picture clicking on "John Doe" or "Jane Doe" would redirect to their page.
image

@vincerubinetti
Copy link
Collaborator

vincerubinetti commented Jan 15, 2025

The feather icon in your screenshot currently only appears if you provide an author that isn't a member of the site, e.g. the post author is some-guy and there is no _members/some-guy.md. When you provide an actual member, it will link to the member's bio page and also show their profile pic like this:

Screenshot 2025-01-15 at 1 32 05 PM

This is the main reason why adding this to the template wouldn't be 100% straightforward, because having many wouldn't look too great.

Screenshot 2025-01-15 at 1 36 32 PM

I'll think about whether/how to include this in the base template, but for now here is a modification you can make to the post-info.html component to support a comma-separated list for the author parameter:

  {% if include.author %}
    {% assign authors = include.author | split: ", " %}
    {% for author in authors %}
      {% assign member = site.members
        | where_exp: "member", "member.slug == author"
        | first
      %}
      {% if member %}
        {% include portrait.html lookup=author style="tiny" %}
      {% else %}
        <span data-tooltip="Author">
          {% include icon.html icon="fa-solid fa-feather-pointed" %}
          <span>{{ author }}</span>
        </span>
      {% endif %}
    {% endfor %}
  {% endif %}

If I were to add it to the template, I'd want to: 1) make the display more compact when showing more than one or two authors, 2) provide a separate authors param like you mentioned but still support author and force it to be only one, and 3) allow authors to be a comma-separated list or actual yaml/frontmatter list, like the other cases of list-based parameters in the template.

@vincerubinetti
Copy link
Collaborator

Also keep in mind that it needs to be compact because the same info/component appears on the blog post listing page:

Screenshot 2025-01-15 at 1 41 57 PM

@shift16
Copy link
Author

shift16 commented Jan 16, 2025

Thank you for the code!

Also, if adding this feature becomes a headache for you, then don't worry about it. You have put so much work into this already and I really appreciate it. 🙂

That being said, I have 2 ideas on how to compact the visuals:

  1. Compressing images to the left and having the names clickable on the right
    image
    Here the images would get compressed to the left and overlap. To get more details about one of the authors, the user would be able to click on each individual name present.

  2. Compressing images to the right, and having the names clickable on the right (enhanced)
    image
    Just like 1. but hovering over the name would cause the image to move above the rest

  3. (I had other ideas last night and forgot them)

@vincerubinetti
Copy link
Collaborator

vincerubinetti commented Jan 22, 2025

Your sketches are interesting, I haven't seen that particular layout before. I probably wouldn't do that in the template though, only because it would make the portrait component more complex (or require a specialized "stacking" portrait component) to make the pictures overlap like that, and I try to avoid complexity in the template at all costs (unless it's a feature that a majority of people want).

So, I think your sketches are a case where I would say it is up to you do to this in your specific instance of the template, and I can assist if you need help.

As for having multiple authors in the simpler/more straightforward way I gave in the code above, I might just put this in the template since it's relatively simple, and if a user has a post that ends up looking like this...

Image

... it's kinda on them. Or maybe I will take the time to truncate the number of authors to 3 with an "et. al." after.

@vincerubinetti vincerubinetti added the enhancement New feature or request label Jan 22, 2025
@vincerubinetti vincerubinetti linked a pull request Jan 24, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants