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

Randomize member page? #69

Closed
vgururao opened this issue Aug 1, 2020 · 7 comments
Closed

Randomize member page? #69

vgururao opened this issue Aug 1, 2020 · 7 comments
Assignees
Milestone

Comments

@vgururao
Copy link
Contributor

vgururao commented Aug 1, 2020

The member directory should be sortable by alphabetical order as currently shown, but that should not be the default view since it arbitrarily over-exposes some members and under-exposes others. Default sort order should be some flavor of random, so at each visit you see a different few people above the fold. Other sort orders can be added (alphabetical, chronological by join date, project contribution karma...). Potentially integrate this idea with the "featured" member thing... where the featured member is also the random top member or something.

@tilnow
Copy link
Contributor

tilnow commented Aug 2, 2020

is it enough/ok that the "random" order be fixed at build time?
is it acceptable if we just start member list at some random location and then go in order?

just asking, not yet sure how to implement this. though i think i would build a new list members_random from the existing list in members, in member-list.html

@vgururao
Copy link
Contributor Author

vgururao commented Aug 2, 2020 via email

@tilnow
Copy link
Contributor

tilnow commented Aug 3, 2020

looks like jekyll has a built in filter called sample that does it. see also https://stackoverflow.com/questions/27179385/how-do-i-shuffle-the-order-of-an-array-in-jekyll

@tilnow tilnow self-assigned this Aug 3, 2020
@necopinus
Copy link
Contributor

In particular: https://stackoverflow.com/a/59833695

Cut-and-paste between lines 10 and 11 in _layouts/member-list.html, tweak some variable names, done.

...And I'm realizing that the entire approach with taking the modulo of the date that we've use elsewhere is way too complicated; we should just be piping the array we want to randomize to sample, and then piping the output of that to first to strip the "array-ness" off of the resulting single-element array.

@tilnow
Copy link
Contributor

tilnow commented Aug 5, 2020

the reason why i decided not to change that is that i now generate the "featured_one" as a number. that number is part of the site data and can be used all over the place.

@tilnow
Copy link
Contributor

tilnow commented Aug 5, 2020

i see you did not push (neither did i yet - lets decide tonight). here is my code:
`---
layout: minimal

Members

{{ content }} #change starts here {% assign num_members = site.members | size %} {% assign membs = site.members | sample: num_members %}
{% for member in membs %}

#and ends here
{% if member.date <= site.time or site.future == true %}
{% include member-card.html %}
{% endif %}
{% endfor %}

`

@tilnow
Copy link
Contributor

tilnow commented Aug 6, 2020

pushed. works. see at https://inspiring-villani-8898ca.netlify.app/members/

@necopinus necopinus added this to the v2.5 milestone Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants