facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
55.87k stars 8.37k forks source link

RFC: Blog authors pages #10196

Closed OzakIOne closed 2 months ago

OzakIOne commented 3 months ago

Have you read the Contributing Guidelines on issues?

Description

A page with a list of author names, grouped by letters (eg: Author Geoff Graham — Smashing Magazine / Chris Coyier on CSS-Tricks - Archive ) A view all authors page like : View all tags /blog/tags

Here is a visual for the view all author page: view all authors

I'll try to mock a visual for the new design of blog/authors/${name} and the new design when viewing a blog post with the social icons

Here is a visual for blog/authors/${name}

design 3

Has this been requested on Canny?

https://docusaurus.io/feature-requests/p/blog-author-pages

Motivation

It's a nice feature to have which other blogs have and it has already been implemented and asked by the community

@halildurmus @shochdoerfer @reda-jaifar @ilg-ul Have shown their interest in this feature

Perhaps you have ideas for the visuals, I've made some quick mockups if you have any preference or ideas tell me

API design

recap from existing conversation about this feature : docusaurus #9825

we should generate an author page for all authors.yaml authors by default, and have an option to opt-out. blog.generateAuthorsPage: boolean (defaults: true if authors.yml exists)

The author.url should also be removed and replaced by blog/authors/${name} list url just like others blogs (smashingmagazine)

Maybe we might add a blog.postsPerAuthorPage just like the https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-blog#postsPerPage

Then you can swizzle the author page and decide to sort, group, and display the posts of that author the way you want. You can order the post by date, event_date, last update time or whatever you want, implement your own layout, and group the posts by whatever attribute or custom front matter.

First introduce the ability to have "social icons" next to the author's name (asked here) Which websites should we support for the logos ? Twitter github medium ? Should we not use logos at all ?

description will removed in favor of social icons unless there is none. We'll still show the description in the blog/authors/${name}

The api and design for view all authors should be fairly similar to view all tags

Have you tried building it?

Implemented by @ilg-ul in https://github.com/cronica-it/docusaurus-chronology/commit/746583324ad0655479b1199d52d9203d99508134 The implementation adds a NamedAuthor type, similar to Tag and the code is basically a duplicate of the tag logic.

Self-service

ilg-ul commented 3 months ago

My code is indeed a duplicate of the tag logic, which is relatively complicated, perhaps you can do it better.

One major issue I encountered was the lack of a unique key in the Author definition, needed to generate the permalink.

I don't know now, but by the time I did that experimental implementation, the author name was neither mandatory, nor unique, thus the need to add a new definition NamedAuthor with a unique field, and an array of such objects, with the authors that have a name allowing to generate the unique field (see the makePermalinkFromAuthorName() function).

If needed, you can reuse any parts of my code, everything is licensed under MIT, so a short reference to the initial author is enough.