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

add authors page #147

Merged
merged 2 commits into from Nov 17, 2018
Merged

add authors page #147

merged 2 commits into from Nov 17, 2018

Conversation

shaform
Copy link
Collaborator

@shaform shaform commented Nov 17, 2018

So I am trying to add a more prominent author information section into the post page. But I guess it's useful to implement #114 as a first step. Currently, data/authors only has a display name field, but I am planning to add more things to it in the future.

However, there is something to discuss:

I personally feel that rather than keeping using the author field, it would be best to use an authors field, which takes a list of authors as its value. Because this would match the convention of tags and categories, and it's also potentially possible that an article might have multiple authors. However, there is already a singular author field in the past. So simply removing it might cause some compatibility issues. On the other hand, if we support both fields, it would be a little bit cumbersome. Not sure what is the best strategy here.

@shaform shaform requested a review from xianmin November 17, 2018 00:24
@@ -24,7 +24,7 @@

<!-- author & description & keywords -->
{{- if or .Params.author .Site.Author.name -}}
<meta name="author" content="{{ if .Params.author }}{{ .Params.author | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}" />
<meta name="author" content="{{ (index .Site.Data.authors (.Params.author | default .Site.Author.name)).name.display | default .Params.author | default .Site.Author.name | safeHTML }}" />
Copy link
Owner

@xianmin xianmin Nov 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a problem here:

(index .Site.Data.authors (.Params.author | default .Site.Author.name)).name.display

If I don't have an "author data file" in the Site root , example /data/authors/example_author.toml . Then, Hugo will output ERROR: error calling index: index of untyped nil.

Is there a better function to avoid this problem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I only tested when the author id is not available but didn't test the case when there is no authors file. Let's me investigate...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@xianmin
Copy link
Owner

xianmin commented Nov 17, 2018

Thanks for your great work!
To my opinion, keep it as simple as before is better, that keeping using the author field.

Multiple authors is extra feature. If someone need this feature and authors field is necessary, we could add a description document.

@shaform
Copy link
Collaborator Author

shaform commented Nov 17, 2018

Okay. The current implementation is to use the author field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants