-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Standardize author data #1850
Standardize author data #1850
Conversation
|
85cd69c
to
30d3e29
Compare
I just changed the directory to |
@derekperkins This is good stuff. The best part is the "params," which means it's extensible, which makes me happy. Here is an uber nitpicky suggestion, so take it however you'd like. If conventions are the ultimate goal, how about naming parameters in a more => less abstracted style:
Does the Thanks for all the work on this. The Hugo community is freakin' awesome. |
I think social should benefit from the same treatment as author as loads of |
@spf13 Are you saying that you prefer using a fixed struct for social as opposed to a |
Yes, I think it needs a display name similar to WordPress. Not every site wants to use real names. You do bring up a good point though. Maybe we should make a function for themes to use that does a few fallbacks, checking first for DisplayName and then falling back to Given + Family.
I switched to an underscore because that's how
I personally prefer Pascal over snake casing. I thought I remembered seeing somewhere that data files only used lowercase, but I couldn't find a reference. I'm more than happy to switch to Pascal casing. |
@rdwatters & @spf13 - For social, I could potentially do a transparent map. We have a struct for the most common networks, but make all of them accessible through a function. When reading the data in, I could store any unmatched networks in that map and return them as if they were natively supported. That allows for more extensibility while still retaining a definite standard. |
It doesn't need to be a struct necessarily, but I'd like to have some definition around what Social means and make it universal and standard. Part of this would be making sure that the keys are consistent across all places social is used. To look at your example: You've gone ahead and provided usernames/tokens for each of these values while others may put full URLs in them. Templates/Themes would really struggle with rendering these in a standard way. I'm not sure what the right answer is, but whatever it is it needs to be consistent so that Themes can just be interchangeable. Perhaps the ideal approach is to allow the definition to be loose but the parsing and internal access to be rigid. This would mean that "google" and "googleplus" would both match the social network "google". The ingestion could examine the input and parse it out into separate url and token values for each social network. I would think a struct like:
Or something similar for each social network would be defined in the code. Then inside Site and Author you would have a map of [socialnames]SocialEntry. Not sure if any of that made sense, but the idea is similar to how we handle params. |
I'm currently parsing out usernames even if someone enters the full url or eliminating the
Do you feel strongly about that? I'd rather just tell people what to put in their config. I can move forward with the structs you suggested. Having |
I don't feel strongly about that at all. As long as the documentation is clear, I'm fine with declaring the keys to use. |
49b4f8e
to
93e41a1
Compare
Any updates? I think this would be a nice addition. |
hugolib/author.go
Outdated
LongBio string | ||
Email string | ||
Social AuthorSocial | ||
GivenName string // given_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the comments are meant to be here, but if you suggest some kind of "XML or JSON" naming here, you might as well add JSON tags here so it gets used when people do {{ author | jsonify }}
That would be useful, come to think of it.
Is this going to be part of the 0.17 release? I don't see any activity here for over a month, so wanted to offer my help if there is anything else remaining (documentation?) for this to be part of the next release of hugo. I've been doing some similar work on my personal theme to add better support for Author metadata, so I'd really like this to be standardized for general users of Hugo. Let me know how I can help! Great addition @derekperkins! |
Ok, I just switched to camelCase and rebased on top of the current master. @dencold / @ryanwalls: I don't have time to create documentation, so if you could flesh that out, I don't see any reason this shouldn't be merged for 0.17. |
Because this pull request is already open for a while I began to refactor the Temporary, I created a branch on my own fork for the additions. Depending on the state of this pull request, I could create a temporary branch in this repo (like multilingual) in which this pr and my additins will be merged. A few things are still undiscussed:
|
I think URL should remain a switch. Different networks are going to have different ways to handle them, which a map can't handle. I don't think the switch is hard to read. I think this PR should get merged as is, and we can discuss further implementation details like you've brought up in their own separate discussions. |
@digitalcraftsman Thanks for working on tests. I love the idea for prompting author creation on a new site. |
Let the others decide. I don't mind both approaches. Regarding the prompt: we should create an internal template for an author file. The user can either ignore the generation of an author (if it makes no sense) or he can fill out the minimum of information needed. In the last case we insert the given data into the template and save it as an author file. Furthermore, I would like to introduce an |
I added some documentation to my branch for this feature. |
I wanted to chime in to say I really like the direction of this PR. Glad we are getting close to a standard for Author support in Hugo, going to help theme authors & downstream users a lot. I had a couple of thoughts here.
I'm happy to contribute documentation and anything else to get this feature greenlit for the next release. It's a nice step forward. Thanks again everyone! |
@dencold I agree that it's better to use only a completely seperate command for the profile creation instead of modifying |
83d3ba7
to
f859ce9
Compare
@derekperkins, I unlocked #3088. |
We may add it again in the future, but let us try to keep the API as small as possible for now. See gohugoio#1850
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
Can this be updated reviewed? But instead of data make it flexible to configure where data of authors is stored. It can be in data or taxonomy as many sites use taxonomies for multiple authors. This data can be made available through |
2021 Update - Good News 🎉There are no official docs, but someone has documented how |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Here's the first attempt at standardizing Hugo author details.
/data/authors
with one file per author. I thought about nesting it in/data/site/authors
or/data/hugo/authors
, but those seemed unnecessarily hidden..Author
method to return a single author.if there are multiple authors and this is used, there is no guarantee which author will be returned
.Site.Author
frommap[string]interface{}
toAuthor
, though I don't know if that is in use outside of the embedded RSS feed.URL()
convenience method that returns canonical urls for major social networksmap[string]string
instead ofmap[string]interface{}