MathSoc / mathsoc-website

A 2022-24 redevelopment of the University of Waterloo Math Society's website.
9 stars 3 forks source link

Use more Markdown data #238

Closed some-molasses closed 1 week ago

some-molasses commented 3 months ago

Request

Please go through the code and find any locations where we could simplify our data schemas to just use a [fieldName]Markdown attribute! One example is highlighted below, but there's likely to be many more throughout.

(maybe leave any title attributes as-is though. We only want Markdown to be usable for "body" parts of the page)

Background

Execs and board have expressed generally wanting to be able to customize the website, and we should try to support that where feasible! One good way to do this would be to increase our use of Markdown data fields throughout the site.

Take http://localhost:3000/services/student-services as an example. Our current setup enforces that there will be a list of some sort under Board Game Nights and Math CnD, but not for the other two services.

Instead of defining the schema like

{
      "title": "Math CnD",
      "description": "Math CnD is owned and operated by the Math Society and located on the 3rd floor in MC Building. CnD has a great selection of food choices at student friendly prices such as coffee & donuts, hot soup and entrees, cold sandwiches, Wasabi Sushi, fresh patties and samosas, and so much more. It’s worth the trip to MC!!",
      "subdescription": "Don’t forget our daily specials, which are always in a limited supply:",
      "items": [
        {
          "item": "Monday - Mac 'n Cheese"
        },
        {
          "item": "Tuesday - Soup (Creamy Potato With Bacon always available)"
        },
        {
          "item": "Wednesday - Chicken Stew"
        },
        {
          "item": "Thursday - Soup (Boston Clam Chowder always available)"
        },
        {
          "item": "Friday - Chili and Garlic Bread Stix (sold separately)"
        }
      ],
      "contacts": [
        {
          "contact": "The Store Manager Rose Penner can be reached at: 519-888-4567 ext. 36373 or at r2penner@uwaterloo.ca."
        },
        {
          "contact": "Math Society - CnD"
        },
        {
          "contact": "3rd Floor, MC Building"
        },
        {
          "contact": "200 University Ave. W."
        },
        {
          "contact": "Waterloo, ON N2L 3G1"
        }
      ],
      "img": "/assets/img/services/mathcnd.jpg"
    }

it would be really nice if we could just do

{
      "title": "Math CnD",
      "descriptionMarkdown": "<p>
    Math CnD is owned and operated by the Math Society and located on the 3rd
    floor in MC Building. CnD has a great selection of food choices at student
    friendly prices such as coffee &amp; donuts, hot soup and entrees, cold
    sandwiches, Wasabi Sushi, fresh patties and samosas, and so much more. It’s
    worth the trip to MC!!
  </p>
  <p>Don’t forget our daily specials, which are always in a limited supply:</p>
  <li>Monday - Mac 'n Cheese</li>
  <li>Tuesday - Soup (Creamy Potato With Bacon always available)</li>
  <li>Wednesday - Chicken Stew</li>
  <li>Thursday - Soup (Boston Clam Chowder always available)</li>
  <li>Friday - Chili and Garlic Bread Stix (sold separately)</li>
  <p>
    The Store Manager Rose Penner can be reached at: 519-888-4567 ext. 36373 or
    at r2penner@uwaterloo.ca.
  </p>
  <p>Math Society - CnD</p>
  <p>3rd Floor, MC Building</p>
  <p>200 University Ave. W.</p>
  <p>Waterloo, ON N2L 3G1</p>"
    }

Then, the CMS can make full use of the markdown editor to allow execs much greater customizability!

image

This page isn't the only spot where we could make this improvement.