Changes

Jump to navigation Jump to search

Github

3,879 bytes added, 12 November
no edit summary
A full Git tutorial is beyond the scope of this document, but in general, here's how you do things with regular command-line Git (TortoiseGit and other GUI-based Git clients will be different!).
To work on a clone the Hacksburg website's GitHub repository, you must first clone it by runningrun:
<filepre>git clone [url]https://github.com/hacksburg/hacksburg.github.io</filepre>
where [url] is the URL of the repository. This will create a subdirectory with the contents local copy of the remote repository in iton your machine (which you can then modify).
=== Github Pages ===
The Hacksburg website lives at [httphttps://hacksburg.org hacksburg.org]. It's hosted on Github's servers (thereby taking advantage of Github's good uptime). The repository is [https://github.com/hacksburg/hacksburg.github.io here].
==== Posting to the Site ====
The site is built automatically using Jekyll[https://github.com/features/actions GitHub Actions]. Every time a pull request is merged into the master branch, so [https://github.com/Hacksburg/hacksburg.github.io/blob/master/.github/workflows/build-and-upload.yaml an action] runs which executes [https://github.com/Hacksburg/hacksburg.github.io/blob/master/build.py build.py] to write a new post you will need to be added posts to the [https://github.com/Hacksburg/hacksburg Hacksburg GitHub group]. Once you have access to that, clone the repository locallygithub. Then, copy the format of one of the existing articles in the _postsio/blob/master/ directory, including the filename conventionindex.html index. Next, update html] based on the date and time contents of the filename to the current date and time, and change the title to something more meaningful (Ex[https: ''2015-06-02-1556-post_title//github.com/Hacksburg/hacksburg.github.io/blob/master/posts.json posts.markdown'')json].
Change the data in the "frontmatter" To create a new post (the section between the lines containing only dashesor modify an existing one) to match your new post, and then write clone [https://github.com/Hacksburg/hacksburg.github.io the remaining article in repository], modify [https://guidesgithub.com/Hacksburg/hacksburg.github.comio/featuresblob/mastering-markdownmaster/ Markdown syntaxposts.json posts.json], and create a pull request. When you've done that, 'git add' the file you madeOnce your pull request is merged, 'git commit' with a message about the article you wrote, action will run and 'git push origin master' to get github to rebuild the pageyour post(s) will be live at [https://hacksburg.org https://hacksburg.org].
If you want to include images, put them in the images/ directory and reference them in the article as "/images/[filename]".=== Post Structure ===
Posts, as defined in [https://github.com/Hacksburg/hacksburg.github.io/blob/master/posts.json posts.json], have the following structure:<pre>{ "title": "Tenth Annual Hacksburg Cider Making", "subtitle": "Fresh, all-natural, and delicious!", "description": "<p>Come to Hacksburg with apples and you'll be able to make your own cider! The best kind of apples to bring is a variety, only using one type typically results in extremely sweet or tart cider. Ten pounds of apples makes three quarts of cider. Free to anyone in the community, no RSVP required.</p><p>Want more information? We go into the cidermaking process in detail here: <a href=\"https://hb.gy/0nAyF\" target=== Blog style ====\"_blank\">https://hb.gy/0nAyF</a>.</p><p>Cider making is for attendees of all ages. If you are bringing an attendee under 18, you (the parent/guardian) must stay the whole time your child/dependent is there.</p>", "date": "2024-10-20", "start_time": "1:00pm", "end_time": "4:00pm", "offsite_location": null, "offered_online": false, "offered_in_person": true, "member_price": 0, "non_member_price": 0, "image": "2018_cidermaking.jpg", "meetup_link": "https://www.meetup.com/hacksburgva/events/302852557/", "cancelled": false}</pre>
The style of the blog build.py script uses Bootstrap these variables to make it adaptive ('responsive')build index.html automatically.Post images are stored in [https://github.com/Hacksburg/hacksburg.github.io/blob/master/resources/images /resources/images]. You can reference an existing image in your post, or add a new one. === Building Posts Automatically from Meetup Data === For your convenience, and a [https://github.com/Hacksburg/hacksburg.github.io/blob/master/rss_to_json.ipynb Python notebook] is based heavily on the example blog template provided on Bootstrapthat scrapes [https://www.meetup.com/hacksburgva/ Hacksburg's home Meetup page] to generate posts in the posts.json format. Note: For this script to work, you must be logged into Meetup. It is recommended that you preview your post(s) before creating a new pull request. A number  === Previewing Posts === To preview your post(s) locally,# Modify and save your local version of <code>posts.json</code># Run <code>build.py</code> to update <code>index.html</code># Run <code>python -m http.server</code> (or other similar command) to initialize a local webserver# Open <code>http://localhost:8000/</code> (or similar) in your web browser to preview your changes have been made  == Creating a Pull Request == To create a pull request, follow these steps: 1. Create and switch to this templatea new branch for your changes:<pre>git checkout -b your-branch-name</pre> 2. Add your modified files to the staging area:<pre>git add posts.jsongit add resources/images/your-new-image. If jpg # if you'd like added a new image</pre> 3. Commit your changes with a descriptive message:<pre>git commit -m "Add new post for upcoming cider making event"</pre> 4. Push your branch to redesign or modify GitHub:<pre>git push origin your-branch-name</pre> 5. Visit the design, [https://github.com/Hacksburg/hacksburg.github.io Hacksburg website repository] on GitHub 6. You should see a prompt to "Compare & pull request" for your recently pushed branch. Click it . 7. Fill out the pull request form:* Give your PR a descriptive title* Add any relevant details in the description* Request review from another board member if needed 8. Click "Create pull request" Once your pull request is probably approved and merged, GitHub Actions will automatically rebuild the site with your changes. Your new post should appear on [https://hacksburg.org hacksburg.org] within a few minutes. == Best Practices == * Always preview your changes locally before creating a good idea to get acquainted with the Bootstrap documentation beforehandpull request* Use clear, descriptive commit messages* Include any relevant context in your pull request description* Make sure images are appropriately sized and optimized before adding them* Double-check dates, times, as well as HTML and CSSlinks in your posts* If you're unsure about any changes, so ask another board member to review them == Troubleshooting == If you can make encounter issues: * Check the changes [https://github.com/Hacksburg/hacksburg.github.io/actions GitHub Actions tab] to see if there were any build failures* Verify your JSON syntax is valid using a tool like [https://jsonlint.com/ JSONLint]* Ensure all required fields in posts.json are properly filled out* Make sure any new images are committed to the repository* If you need help, reach out to a sensible way.board member for assistance
2
edits

Navigation menu