Problem/Motivation
Providing a "logo" image for projects is somewhat instrumental to the design for project browser. Many projects do not have images right now. Operating under an incorrect assumption that we shouldn't change Drupal.org, we figured we would make sure that projects that did have logos would set the logo as their first image in field_images on Drupal.org.
There are, however some alternatives.
Proposed resolution
We need to decide between what currently look like three options:
- Continue with the original plan. Make the logo the first in field_images. This requires 0 changes at Drupal.org, and works for the prototype, but doesn't necessarily work long-term. Longer term we assumed option 2.
- Add a field_logo to the Drupal.org module_project nodes. This is a single-value field of structured data. We are already fetching Drupal.org project data, so it would be easy to see if this were NULL/empty or filled out, and push the link down to PB appropriately.
- Use the logo from the GitLab instance. This requires a quick-shift, as we are about to make a big push to get maintainers to do option 1. Downsides here means two API calls, d.o. and GitLab, but long term that's probably not bad since that split-data architecture is inevitable. Logo URLs are predictable and could be set, but we'd still need to do a HEAD request or an API request to GitLab to fetch the data. Not sure what's involved for authentication to the GitLab API here, and if making this requests client-side would be possible. If not, we'd need a HEAD request to first see if the image was there, and if not display our fallback.
Remaining tasks
- ✅ File an issue about this project
- ☐ Open discussion to come to consensus
- ☐ Make decision
- ☐ File follow-up image to update code as needed
User interface changes
none
Data model changes
image could come from somewhere else
Comments
Comment #2
mradcliffeI think that #1 is still the option for getting something working now. The URL can be changed later in t he code. However we should also make it a task for maintainers to do BOTH. Add the logo in the repository as soon as possible AND add it as image 0 on the d.o. project page.
Then we as contrib maintainers do both one time (hopefully).
Comment #3
thejimbirch commentedI'd vote for #2 for a long-term solution. It appears that is how WP does it, and since all the other data comes from d.o, I feel this should also.
#1 could be used temporarily.
#3 feels like forcing the maintainer to use new features. I for one don't do much in Gitlab as I can still work in the workflow I have always done.
Comment #4
drummWhere are the guidelines for logo size and recommendations for how to make a good logo?
Comment #5
fjgarlin commentedWP actually uses a solution much closer to #3. There is a file in the repo and that file is used as logo.
If you inspect https://wordpress.org/plugins/ all the icons are pulled from https://ps.w.org/PROJECT-NAME/assets/ICON-FILE.png where ICON-FILE.png is inside the "assets" folder in the repo. ie: https://plugins.trac.wordpress.org/browser/wp-google-maps/assets
--
My thoughts:
#1 As mentioned on the slack threads "I would strongly recommend against using a convention to dictate meaning, 'i.e. the first image we treat as a logo' is going to come with problems.". I gave a +1 here as these are exactly my thoughts. If we're going to have people make a push on adding logos, I'm not sure this should be the right one as we already know that we don't want this long-term, so they might need to end up adding it again in another place.
#2 This could work long-term. It could be a "Link" field actually where we provide the URL. This would give flexibility to leverage #1 or #3 or any other reachable image. However, we'd lack validation in size/format/etc. So it could be an image, or even a checkbox "Use gitlab logo" and if the checkbox is disabled, then allow for image upload (so kind of #2 and #3 mixed up).
#3 I still like this option as it's similar to the `screenshot.png` image in Drupal themes, so having a logo in the repo for that project makes sense. It uses the same logic as WP plugin browser and of course, GitLab itself. See the first results here: https://gitlab.com/search?search=php
In regards to "forcing the maintainer to use new features". It's just adding an image to the repo. The maintainer is probably closer to the code than to the d.o edit page, and in any case, wouldn't we "forcing" them to upload an image in the d.o edit page?
In any case, it's great to have different options for an MVP, and regardless of the chosen one, it's an amazing project, so happy either way.
Comment #6
thejimbirch commented@fjgarlin
If that is the case, #3 does sound like the best long-term option. I misunderstood the Gitlab conversation in slack. I thought you had to upload the image to Gitlab, not add it to your repo.
That would put more work on the drupal.org implementation I would think, but be well worth it. I don't think the image that is in themes is pulled into drupal.org, so maybe this is a chance to standardize across all projects.
@drumm
I don't think that is finalized. I will make a ticket.
Comment #7
thejimbirch commentedAdded:
Create guidelines for logo size and recommendations for how to make a good logo
Comment #8
pasqualleIs there any use case when the project prefers to not have the logo file in the repository? I guess it should be ok for Drupal modules and themes.
https://stackoverflow.com/questions/40049648/how-to-add-icon-to-my-repos...
gitlab also allows to upload the logo, but it seems this settings page is disabled on drupalcode.org. Are there any plans to enable this feature? In case this feature is enabled, then the gitlab api should to be used to retrieve the logo. (probably this one: https://docs.gitlab.com/ee/api/appearance.html)
github does not have the option to use a "magic" file as logo. It supports upload only:
https://docs.github.com/en/repositories/managing-your-repositorys-settin...
for image size github recommends:
Max file size seems
github 1MB (recommended? source)
gitlab 200KB (hard limit source)
I would like to follow best practices, and use what is available in gitlab, but as drupal.org uses its own project pages, it is not a clear choice.
Comment #9
fjgarlin commentedJust created an issue and added an MR as a proof of concept of how easy it'd be to get this feature working with gitlab (#3 of the options discussed).
* Issue: https://www.drupal.org/project/gin/issues/3278200#comment-14501397
* MR: https://git.drupalcode.org/project/gin/-/merge_requests/136/diffs
Comment #10
saschaeggiMy two cents on this:
As we will use the «card» component and we already use this component for displaying the themes on the appearance page (which uses the
screenshot.pngbtw.) we could use the same dimentions for the logosee https://www.drupal.org/docs/7/theming/tools-and-best-practices/creating-...
If not, I'd vote to deprecate the
screenshot.pngfor themes and also use the logo on the appearance page.Comment #11
chrisfromredfinIn terms of #1 - that's all we have to work with if we want to ship something now sooner rather than later, FWIW. Though we could always use a fallback. With that said, most of the effort being put forth initially is not about getting a maintainer to upload their logo in some other way, but in actually CREATING logos for many projects, a large-scale creative effort. Point is, I don't want to freak out toooo much about "what if a maintainer adds this as their image, then 8 months later they have to add it to Git?!" It's less of an issue.
It seems like most people are leaning toward #3 as the long-term solution, and I don't disagree. However, Pasqualle's comment got me thinking "uh oh if there's two ways this could cause headaches." However, what Pasqualle linked to is top-level branding for the GitLab Installation, and we're talking about per-project logos for contrib projects.
The point about the themes is interesting, but of note is that we're mostly going for square in Project Browser while screenshots are going for 4:3 (and the Github references made are 2:1). With that said, there is much utility in having a screenshot for a theme, possibly in addition to a logo, so I don't want to talk too much about themes.
According to fjgarlin's POC MR - the magic URL is "put a logo.png in the root of your project" - The reason I'm most attracted to #3 is that with logo.png available in the repo, similar to screenshot.png for themes currently, we have opportunities to re-use that in other places inside Drupal in the future, rather than keeping that data to ourselves on Drupal.org. What is a bit different is a theme provides logo.png already, which already HAS a meaning in Drupal, yeah? When Project Browser expands to include a "theme browser," too - how does "logo.png" interplay with what's there?
Comment #12
fjgarlin commentedAnother example of #3 within this project. It just leverages the feature already available in Gitlab.
Issue: #3284321: Official logo for project to be used as avatar
MR (already merged): https://git.drupalcode.org/project/project_browser/-/merge_requests/144/... (just one file, the image)
We can then see the project homepage displaying the new logo: https://git.drupalcode.org/project/project_browser
And the new logo is available at: https://git.drupalcode.org/project/project_browser/-/avatar
Comment #13
lostcarpark commentedI have created #3334550 to look at the documentation for module maintainers.
If we are likely to take approach #3, encouraging maintainters to place the logo in their repos will mean that when implemented, modules will have already started adopting the mechanism. As GitLab uses the same mechanism for project logos, there doesn't seem to be any downside to people putting the logo in their repos.
As @chrisfromredfin says, #1 is the only practical short term mechanism. However, if we start using the logo from the repo, will this be duplicated in the project images? Will maintainers then need to manually remove from images, or should the API look at some way of filtering out the first image if it matches the project logo?
Comment #14
chrisfromredfin@lostcarpark - no, if we use the logo from the repo (I still don't like that it's another call/API request to a different service, but...), then project_images (in the slideshow) would remain their own, independent thing, and logo images could/should be removed from there.
Comment #15
lostcarpark commentedThat seems sensible. I can think of some possibly neat technical solutions, but they all have the potential unexpected consequences.
Would it be practical to have a Drupal field (as per #2) but have it populate with the project image from the repo if available?
Comment #16
drummThat’s not necessarily true. The API Drupal.org provides can combine the data so it is in the same responses. We will likely have that data in the local DB anyway, so it can be displayed on Drupal.org project pages anyway. We may do something like providing the image URL on git.drupalcode.org, that’s still to be determined.
Comment #17
lostcarpark commentedThe D7 based drupal.org pages are now taking the logo from the project repos and displaying to the left of the project title. This has been deployed to the drupal.org production site by #3334783: Integrate GitLab Logo png to Drupal.org D7 project pages.
An example can be seen on the API project: https://www.drupal.org/project/api
Does this have any bearing on this issue?
Comment #18
fjgarlin commentedAlso seen in our own PB project :-) https://www.drupal.org/project/project_browser
Comment #19
chrisfromredfinWe are using the avatar from GitLab.