Skip to content

Add Event

Ishaat Chowdhury edited this page May 22, 2020 · 7 revisions

Create a new event

There are two methods to creating a new event:

  1. Using Netlify CMS (graphical, UI based)
    • Pros:
      • Doesn't require hugo to be installed on your computer
      • Less tedious compared to command line
    • Cons:
      • Can't preview changes locally, need to use deploy previews before pushing to production
      • Not as much control as using commandline (ex. can't make a new post and new event in same PR)
  2. Using hugo new (commandline)
    • Pros:
      • Can preview changes locally
      • More control compared to UI
    • Cons:
      • Can be tedious
      • Requires hugo to be installed on your computer

Using Netlify CMS

Go to https://www.compeclub.com/admin. You should see a login page like this:

netlify_cms_login

Afterwards, you must authorize the CompE Club website to access your GitHub account. This will let the UI make pull requests to our repo on your behalf. Note that you must have contributor access to this repository.

netlify_cms_authorize

Now, you should click Event on the sidebar to the right to get to the events list. You should see the events list. Make sure to sort by Title (Descending) in order to have newer results show up at the top.

netlify_cms_events_list

Now click the New Event button at the top. In this page, you'll see in the boxes on the right where you can change variables such as the title of the event, the start time of the event, and the end time of the event. These correspond to the front matter variables in Hugo. On the bottom right, there is a body section where you can add text describing the event. Once you're satisfied, click the Save at the top. This will create a draft of the event that you can review before you push.

netlify_cms_events_new

Go back to the main page and click the Workflow button on the navbar. You should now see your new draft event in the Drafts queue. Note that we don't use the In Review or Ready columns.

netlify_cms_event_editor_workflow

In addition, a new pull request is automatically created in this repo once you've saved the draft.

netlify_cms_event_pull_request

Now, if you go back to the Workflow page in Netlify CMS and then click on your draft you should see a page to edit the draft. Click on the View Preview button at the top to see a preview of your changes that is created on our build server. If the button says Check Preview instead, wait a few minutes and then refresh the page. You can also view the preview directly from the pull request page in our repo.

netlify_cms_event_edit

This is the preview of our new event.

netlify_cms_event_view_deploy_preview

After you are satisifed, click Publish on the top of the draft page for the event. Now you're done and the changes will be merged to our repo and then pushed to our build server.

netlify_cms_event_edit

Using hugo new

We store newsletter posts with the following path: content/events/events/YYYY-MM-DD-event-name.md.

To create a new event, run the following command from the root of the repo:

hugo new --kind event content/events/events/YYYY-MM-DD-event-name.md

Make sure to replace YYYY with the year, MM with the month, and DD with the day of the event start.

For example, say we want to create a new event on December 19, 2019 for hacktime. Run:

hugo new --kind newsletter content/events/events/2019-12-19-hacktime.md

A new file content/events/events/2019-12-19-hacktime.md will be created and populated with sample content. Replace the sample content with the contents of the newsletter for the week. Replace the sample content with the real contents. Make sure to change the fields start and end to the correct datetime of the start and end of the events as specified in TOML date format. Do not include timezone information, since the build server will assume MST.

+++
fragment = "event"
weight = 100

title = "EVENT TITLE"
start = 2019-12-19T21:12:32
end = 2019-12-19T21:12:32
+++

**When**: INSERT DATE HERE 
**Where**: INSERT TIME HERE

INSERT DESCRIPTION OF EVENT.

The event archetype is located at archetypes/event.md. Although it is entirely possible to create a new event by creating a new markdown file with the correct front matter in the appropriate directory, it is recommended to use hugo new --kind event content/events/events/YYYY-MM-DD-event-name.md to save time and prevent mistakes.

Clone this wiki locally