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!
v1.0 Requirements
Edit line 4 of README.md. Change this line to the following, replacing YOUR_USERNAME and YOUR_REPONAME with your GitHub username and repository name respectively.
Read in the contents of the provided first-post.txt file.
Edit the provided HTML template (template.tmpl) to display the contents of first-post.txt.
Render the contents of first-post.txt using 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 the first-post.html file 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 .txt file in the same directory as your program. Run ./makesite --file=latest-post.txt to test.
Update the save function to use the input filename to generate a new HTML file. For example, if the input file is named latest-post.txt, the generated HTML file should be named latest-post.html.
Add, commit, and push to GitHub.
v1.0 Stretch Challenges
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!
v1.1
v1.1 Requirements
Create 3 new .txt files for testing in the same directory as your project.
Add a new flag to the makesite command named dir.
Use the flag to find all .txt files in the given directory. Print them to stdout.
With the list of .txt files you found, generate an HTML page for each.
Run ./makesite --dir=. to test in your local directory.
Add, commit, and push to GitHub.
v1.1 Stretch Challenges
Recursively find all .txt files in the given directory, as well as it's subdirectories. Print them to stdout to make sure. Generate an HTML page for each.
When your program finishes, print: Success! Generated 5 pages. The Success! 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 .txt files. Are there any ways to make your code faster?
v1.2
v1.2 Requirements
Initialize Go modules in your project.
Use the cobra library in my Static Site Generator project. The documentation is located here. My goal is to use it to improve my ssg as a cli tool.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package cmd holds the commands for the makesite CLI Package cmd holds the commands for the makesite CLI Package cmd holds the commands for the makesite CLI
Package cmd holds the commands for the makesite CLI Package cmd holds the commands for the makesite CLI Package cmd holds the commands for the makesite CLI
Click to show internal directories.
Click to hide internal directories.
go.dev uses cookies from Google to deliver and enhance the quality of its services and to
analyze traffic. Learn more.