Skip to content

Commit

Permalink
add doFollow optional option
Browse files Browse the repository at this point in the history
Signed-off-by: Ansh Goyal <[email protected]>
  • Loading branch information
anshgoyalevil committed Dec 17, 2024
1 parent b91821a commit 477656a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/server/controllers/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default async function banner(req, res) {
const height = Number(req.query.height) || 0;
const { avatarHeight, margin } = req.query;
const showBtn = parseToBooleanDefaultTrue(req.query.button);
const doFollow = parseToBooleanDefaultFalse(req.query.doFollow);

// handle includeAnonymous, default to true for tiers
let includeAnonymous;
Expand Down Expand Up @@ -70,6 +71,7 @@ export default async function banner(req, res) {
margin,
collectiveSlug,
includeAnonymous,
doFollow,
})
.then((content) => {
res.setHeader('Content-Type', 'image/svg+xml;charset=utf-8');
Expand Down
6 changes: 4 additions & 2 deletions src/server/lib/svg-banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function generateSvgBanner(usersList, options) {
// usersList might come from LRU-cache and we don't want to modify it
const users = cloneDeep(usersList);

const { limit, collectiveSlug } = options;
const { limit, collectiveSlug, doFollow = false } = options;

const imageWidth = options.width;
const imageHeight = options.height;
Expand Down Expand Up @@ -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="${
user.slug
}">${image}</a>`;
images.push(imageLink);
posX += avatarWidth + margin;
}
Expand Down

0 comments on commit 477656a

Please sign in to comment.