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

References to .Site.Authors need to be cleaned up? #4458

Closed
kaushalmodi opened this issue Feb 27, 2018 · 16 comments · Fixed by #8344
Closed

References to .Site.Authors need to be cleaned up? #4458

kaushalmodi opened this issue Feb 27, 2018 · 16 comments · Fixed by #8344

Comments

@kaushalmodi
Copy link
Contributor

Hello,

I had opened up https://discourse.gohugo.io/t/site-authors-not-implemented/10446 on Discourse for discussion, but haven't received any feedback.

The gist of the problem is that internal templates like twitter_cards and opengraph reference .Site.Authors, but no matter what I do, those variables do not get set.

While diving through the Hugo source code through my Go-unexperienced eyes, I realized that those variables are "declared" but never "assigned" (not sure what the correct Go-lingo is for that).

You can read the above linked Discourse thread for details and code snippet references.

@bep
Copy link
Member

bep commented Feb 27, 2018

This duplicates #3088 and others.

In general, we have some features that does not exist in the documentation, which means "it doesn't exist".

@bep bep closed this as completed Feb 27, 2018
@bep bep added the Duplicate label Feb 27, 2018
@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Feb 27, 2018

which means "it doesn't exist"

I can understand that, but then they also need to be cleaned up from the internal templates. I discovered this problem as I was debugging why the templates were not setting the twitter:creator meta tag.

That's very confusing.

@kaushalmodi
Copy link
Contributor Author

@bep Would you consider reopening this? This is not a duplicate. This issue is about cleaning up the templates so that they don't refer to the non-functional variables. It plainly causes confusion.

Once the Author proposal in your referred issue is implemented, the templates can be updated accordingly.

At the moment, the templates are trying to access an unimplemented feature, which I categorize as a bug.

@XhmikosR
Copy link
Contributor

XhmikosR commented Feb 2, 2021

Agreed, this is something I just hit myself.

@danielfdickinson
Copy link

When .Site.Authors is a map (as the docs say) this works correctly (according to my testing). I'd argue the docs need to be updated with examples of how to properly configure .Site.Authors rather removing it's usage (I'm planning on doing this today / tomorrow).

Part of the problem is that even hugoBasicExample doesn't do this right (gohugoio/hugoBasicExample#69) but I fix that in (gohugoio/hugoBasicExample#70).

@jmooring
Copy link
Member

When .Site.Authors is a map (as the docs say) this works correctly (according to my testing).

That's great! Please show me how to make it work!

@danielfdickinson
Copy link

danielfdickinson commented Mar 18, 2021

I think I may be misunderstanding part of this -- .Site.Authors allows to access the keys in the config.toml map which is all that I ever found in the docs. The other issue you mention in gohugoio/hugoDocs#1370 is something I never found or noticed (and I think is a separate discussion/feature).

@jmooring
Copy link
Member

.Site.Authors allows to access the keys in the config.toml map

Again, please show me how to make this work.

@danielfdickinson
Copy link

Ok. Oh wait. I didn't notice the plural. .Site.Author is what I was referring to. Sorry for the confusion. I guess the templates really should use .Site.Author.authors (as described in https://discourse.gohugo.io/t/site-author-usage/31459/10), rather than .Site.Authors (and documentation updated).

@jmooring
Copy link
Member

I guess the templates really should use .Site.Author.authors ...

That's a separate issue. This issue is about removing the stuff that does not work. We can add stuff that does work if/when there is a consensus on data structure and associated documentation. Currently the data structure of [author] in config.toml is whatever the site administrator wants it to be.

@danielfdickinson
Copy link

Fair enough. In that case probably the RSS feed shouldn't use hardcoded keys from .Site.Author either, although that is for another PR/discussion, I think.

@jmooring
Copy link
Member

Personally, I use the embedded templates as a starting point, copying them to my projects and then tweaking them to meet my needs or match my data structures.

@danielfdickinson
Copy link

Personally, I use the embedded templates as a starting point, copying them to my projects and then tweaking them to meet my needs or match my data structures.

@jmooring By that logic why not just update these templates with .Site.Author.authors? I don't quite see how the RSS feed is different than the twitter and opengraph templates in that respect.

@jmooring
Copy link
Member

Because that's what I do. I have no idea what everyone else does.

My objective with this issue and the associated PR is to remove what is broken.

If we want to replace it with something, it should be by consensus. There's a long standing open issue that is directly related to how this is handled, #3088.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants