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

feat: add doFollow parameter for contributor links #616

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anshgoyalevil
Copy link

This PR adds a new doFollow parameter that allows collectives to opt-in to
"dofollow" links in their contributor widgets. When enabled, the "nofollow"
attribute is removed from contributor links while maintaining the "sponsored"
attribute for proper link attribution.

Changes:

  • Added doFollow parameter parsing in banner.js
  • Modified link generation in svg-banner.js

The default behavior (nofollow links) remains unchanged unless explicitly
opted into using the doFollow parameter.

Fixes opencollective/opencollective#5968

@DreadKnight
Copy link

@anshgoyalevil Pretty good stuff from what I can tell! Seems from tests that it fails at linting.
Also, the parameter should be listed (documented) in the dashboard table here (ideally) -> https://opencollective.com/dashboard/ancientbeast/export

@anshgoyalevil
Copy link
Author

anshgoyalevil commented Dec 17, 2024

Lint check is passing locally. Here in this PR, GHA won't trigger unless one of the maintainers runs it.

Would have to look around that dashboard table thing. I am not able to view that page on OpenCollective.com as it is only for admins. I might have to clone the OpenCollective frontend locally to view that

@anshgoyalevil
Copy link
Author

Is this the place you are talking about, @DreadKnight?

image

As I can see, the parameters you are talking about won't be added to this page as they are exclusively for json API.

After this PR gets merged, that's how you can ask for a doFollow banner: https://opencollective.com/ancientbeast/tiers/sponsor.svg?avatarHeight=123&width=890&button=false&doFollow=true

Notice a doFollow=true at the end.

@DreadKnight
Copy link

Is this the place you are talking about, @DreadKnight?

image

As I can see, the parameters you are talking about won't be added to this page as they are exclusively for json API.

After this PR gets merged, that's how you can ask for a doFollow banner: https://opencollective.com/ancientbeast/tiers/sponsor.svg?avatarHeight=123&width=890&button=false&doFollow=true

Notice a doFollow=true at the end.

@anshgoyalevil Figured the parameter stuff 👍🏻 I'm talking about this table though (parameters for the widget):

Screenshot_20241217_085919

@DreadKnight
Copy link

Lint check is passing locally. Here in this PR, GHA won't trigger unless one of the maintainers runs it.

Would have to look around that dashboard table thing. I am not able to view that page on OpenCollective.com as it is only for admins. I might have to clone the OpenCollective frontend locally to view that

Yeah, makes sense; can supposedly save some server resources 🐻

@Betree Betree self-assigned this Dec 26, 2024
Copy link
Member

@Betree Betree left a comment

Choose a reason for hiding this comment

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

Can you add screenshots of the results after fixing the issue?

@@ -124,7 +124,9 @@ export function generateSvgBanner(usersList, options) {
const imageLink = `<a xlink:href="${website.replace(
/&/g,
'&amp;',
)}" class="opencollective-svg" target="_blank" rel="nofollow sponsored" id="${user.slug}">${image}</a>`;
)}" class="opencollective-svg" target="_blank" rel=${doFollow ? 'sponsored' : 'nofollow sponsored'} id="${
Copy link
Member

Choose a reason for hiding this comment

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

Missing quotes.

Suggested change
)}" class="opencollective-svg" target="_blank" rel=${doFollow ? 'sponsored' : 'nofollow sponsored'} id="${
)}" class="opencollective-svg" target="_blank" rel="${doFollow ? 'sponsored' : 'nofollow sponsored'}" id="${

=>

image

Please make sure to test your changes, the instructions to start the project are in the README.

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.

contributors widget should have parameter for "dofollow" links
3 participants