Create your own custom Static Site Generator (like Jekyll or Hugo) by cloning and completing this project!
📂 makesite
├── README.md
├── first-post.txt
├── latest-post.txt
├── makesite.go
└── template.tmpl- Visit github.com/new and create a new repository named
makesite. - Run each command line-by-line in your terminal to set up the project:
$ git clone git@github.com:Tech-at-DU/makesite.git
$ cd makesite
$ git remote rm origin
$ git remote add origin git@github.com:YOUR_GITHUB_USERNAME/makesite.gitFor each task:
- Complete each task in the order they appear.
- Use GitHub Task List syntax to update the task list.
Complete the MVP as If you finish early, move on to the stretch challenges.
If you get stuck on any step, be sure to print the output to stdout!
- Edit line
4ofREADME.md. Change this line to the following, replacingYOUR_USERNAMEandYOUR_REPONAMEwith your GitHub username and repository name respectively. - Read in the contents of the provided
first-post.txtfile. - Edit the provided HTML template (
template.tmpl) to display the contents offirst-post.txt. - Render the contents of
first-post.txtusing Go Templates and print it to stdout. - Write the HTML template to the filesystem to a file. Name it
first-post.html. - Manually test the generated HTML page by running
./makesite. Double-click thefirst-post.htmlfile that appears in your directory after running the command to open the generated page in your browser. - Add, commit, and push to GitHub.
- Add a new flag to your command named
file. This flag represents the name of any.txtfile in the same directory as your program. Run./makesite --file=latest-post.txtto test. - Update the
savefunction to use the input filename to generate a new HTML file. For example, if the input file is namedlatest-post.txt, the generated HTML file should be namedlatest-post.html. Rungo run makesite.go --file=latest-post.txt - Add, commit, and push to GitHub.
- Use Bootstrap, or another CSS framework, to enhance the style and readability of your template. Get creative! Writing your very own website generator is a great opportunity to broadcast your style, personality, and development preferences to the world!
- Create 3 new
.txtfiles for testing in the same directory as your project. - Add a new flag to the
makesitecommand nameddir. - Use the flag to find all
.txtfiles in the given directory. Print them tostdout. - With the list of
.txtfiles you found, generate an HTML page for each. - Run
./makesite --dir=.to test in your local directory.(orgo run makesite.go --dir=.) - Add, commit, and push to GitHub.
- Recursively find all
.txtfiles in the given directory, as well as it's subdirectories. Print them tostdoutto make sure. Generate an HTML page for each. - When your program finishes, print:
Success! Generated 5 pages.TheSuccess!substring must be bold green, and the count (5) must be bold. - Modify the success message to read:
Success! Generated 5 pages (18.2kB total).Calculate the total by summing the size of each HTML file, then converting the total to kilobytes. Always return one significant digit after the decimal point. - Determine how long it took to execute your static site generator. Modify the success message to read:
Success! Generated 5 pages (18.2kB total) in 3.25 seconds.Always return two significant digits after the decimal point. - Test your solutions to these stretch challenges on many different directories containing
.txtfiles. Are there any ways to make your code faster?
- Initialize Go modules in your project.
- Add any third party library to your project to enhance it's functionality. Some ideas you might consider include (CHOOSE ONLY ONE):
- Translating page content using Google Translate.
- Parse Markdown (
.md) files and transform them into HTML.#through######should translate to<h1>through<h6>elements. Add to import and then rungo get github.com/yuin/goldmark. go.mod will be updated. - FILL IN THE BLANK:
I will use the _goldmark_ library. The documentation is located at _https://pkg.go.dev/github.com/yuin/goldmark#section-readme_. My goal is to use it to _parse Markdown (.md) files and transform them into HTML_.
- Add, commit, and push to GitHub.
- ACS 4210: Project #1 - SSGs: Code samples you can use to complete the MVP requirements.
- ACS 4210: Files & Directories: Code samples you can use to complete v1.1 requirements.
- ACS 4210: Files & Directories: Code samples you can use to complete v1.2 requirements.