This repository maintains code for the MUNSoc Website located here.
- Make sure you have
nodejsinstalled on your system. - Clone this repository by running this on a shell:
git clone git@github.com:MUNSoc-PESUECC/MUNSocWebsite.git - cd into the cloned directory:
cd MUNSocWebsite - Run
npm installto install all the needed dependencies - Run
yarn run devto localhost the website - You can find the website at
http://localhost:5173
For 90% of the development: you only need to focus on the /src folder, which looks like this:
src
├── app.d.ts
├── app.html
├── app.postcss
├── index.test.js
├── lib
│ └── utils
│ └── index.js
└── routes
├── +error.svelte
├── +layout.svelte
├── +page.js
├── +page.svelte
├── about
│ ├── +page.js
│ ├── +page.svelte
│ └── awards
│ ├── award1.md
│ ├── award2.md
│ └── <AWARD MARKDOWN FILES GO HERE>
├── api
│ ├── awards
│ │ └── +server.js
│ ├── events
│ │ └── +server.js
│ ├── newsletters
│ │ └── +server.js
│ └── posts
│ └── +server.js
├── events
│ ├── +page.js
│ ├── +page.svelte
│ ├── [slug]
│ │ ├── +page.js
│ │ └── +page.svelte
│ ├── testEvent1.md
│ ├── testEvent2.md
│ └── <EVENT MARKDOWN FILES GO HERE>
├── members
│ └── +page.svelte
├── newsletter
│ ├── +page.js
│ ├── +page.svelte
│ ├── [slug]
│ │ ├── +page.js
│ │ └── +page.svelte
│ ├── february2023.md
│ ├── january2023.md
│ └── <NEWSLETTER MARKDOWN FILES GO HERE>
└── posts
├── +page.js
├── +page.svelte
├── 1.md
├── 2.md
├── 3.md
├── <POSTS MARKDOWN FILES GO HERE>
└── [slug]
├── +page.js
└── +page.sveltemarked above where the markdown files for events, posts, awards and newsletters go.
The website is server-side-rendered using sveltekit and hosted on vercel
We use a [slug] model for posts, events and newsletters. All of these are fetched from markdown files and rendered using mdsvex.
The javascript file at /src/lib/utils/index.js is responsible for fetching all of these markdown files. This is then used by the files at /src/routes/api/ to sort by date where applicable and serve them in a .json format.
Every route for these pages also has its +server.js that is responsible to fetch data from the /api/ endpoint. And every [slug] has its +server.js to fetch all the metadata and contents and return it in the form of a javascript variable.
Feel free to approach any of the maintainers or open an issue if you find any :)