PlasmaPy / plasmapy.github.io

PlasmaPy Website
https://www.plasmapy.org
Other
16 stars 23 forks source link

Add an Affiliated Packages page #80

Closed rocco8773 closed 3 years ago

rocco8773 commented 3 years ago

This PR creates the "Affiliated Packages" page and defines the framework for adding community/affiliated packages in the future.

What it does?

  1. Removes the "Page Source" link from the website altogether.
  2. Moves the "Benchmarks" page link to the footer.
  3. Adds the "Affiliated Packages" link to the top menu.
  4. Created a Google Form so projects/organizations can submit a request to be added to the affiliated packages.
  5. Framework for building the "Affiliated Packages" page:
    • Affiliated package information is stored in a json file, /web/data/affiliated_pkgs.json.
    • Several Mako style shortcodes (/web/shortcodes/) and template (/web/templates/) templates were created to automate the html generation of the list.
    • The affiliated packages list is automatically generated using the shortcodes and the json file, so adding a new entry to the json file will automatically add the package to the page upon rebuild.
    • Created a shield.io badge to distiguish PlasmaPy affiliated packages from all other community packages.
    • Generated list is automatically alphabetized.
  6. Added CSS styling to make it all look pretty
  7. Updated the chat links in the top menu and footer to point to Element, not Riot.

Note: This PR should not be merged before we gather a few community packages. I'm assuming we'll have community packages after the APS followup meetings next week. I just wanted this ready for merge so we can advertise it at the followup meetings.


NEW

image

OLD

image

StanczakDominik commented 3 years ago

Built version shows up at https://179-105815475-gh.circle-artifacts.com/0/web/output/affiliates/index.html

rocco8773 commented 3 years ago

That shortcode stuff looks really cool! What resources did you use to figure it out?

I discovered shortcodes in the Nikola documentation when @namurphy mentioned automating the meeting times in PR #79. I have to say though, THE DOCUMENTATION ON THIS IS ATROCIOUS!!!! The format used for shortcodes is either mako or jinja2, depending on the theme your using. bootstrap4 (our theme) is mako. Additionally, if you want to make shortcodes that are importable by other shortecodes, then that file must be placed in the /web/templates/ folder. This took me hours to figure out from this terribly written sentence in the Nikola documentation...

For example, if you define a macro foo(x, y) in templates/shared_sc.tmpl, you can include shared_foo.tmpl in templates/special_post.tmpl and shortcodes/foo.tmpl and then call the ${shared_foo.foo(x, y)} macro.

All grumbling aside, this is a very nifty tool to have once you understand how it works.

rocco8773 commented 3 years ago

Thought...we should make "Affiliated" and "Community" shields that could be copied from the website and added to other project's websites and/or package's README's.


Affiliated Shield: PlasamPy Community Shield: PlasmaPy

rocco8773 commented 3 years ago

Ok, I've added several styling changes to the the display...

  1. If a project does not provide an image, then their name will be automatically placed into the pkg thumbnail.
  2. I added a field for the pkg license.
  3. The pkg description, license, and keyword fields will automatically scroll vertically on overflow.

The current build (at the time of this comment) can be found here.

@namurphy Can you please look over the PlasmaPy entry and give any comments on the text?

@Didou09 Can you look over the tofu section and give any comments or approval?

Didou09 commented 3 years ago

Good for me @rocco8773 , nice page :+1: Question: how do I get the nice image badge to put it on tofu's page too ? (same question for the community badge, which url do you recommend using ?)

rocco8773 commented 3 years ago

@Didou09 Thank you!

Good question! I plan to put instructions on how to add a shield to your repo in a follow up PR, but for now you can add the the shield by doing the following...

  1. copy this link address
  2. put the following markdown snippet into your README.md [![PlamsaPy](paste link address)](https://www.plasmapy.org/affiliates/)
  3. this should render like PlasmaPy

Note: The shield link will return a "page not found" until this PR is merged.

For the Community Shield, you'd copy this link address. Then you'd same markdown snippet as above to get PlasmaPy.

I hope to make this process more efficient once I add the instruction to the website. I'll ping you when this happens.