Create your own custom Static Site Generator (like Jekyll or Hugo) by cloning and fulfilling the requirements in this repo!
📂 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:
$ cd ~/go/src
$ git clone git@github.com:Make-School-Labs/makesite.git
$ cd makesite
$ git remote rm origin
$ git remote add origin git@github.com:YOUR_GITHUB_USERNAME/makesite.git
For 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
4
ofREADME.md
. Change this line to the following, replacingYOUR_USERNAME
andYOUR_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 offirst-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 thefirst-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 namedlatest-post.txt
, the generated HTML file should be namedlatest-post.html
. - 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
.txt
files for testing in the same directory as your project. - Add a new flag to the
makesite
command nameddir
. - Use the flag to find all
.txt
files in the given directory. Print them tostdout
. - 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.
- Recursively find all
.txt
files in the given directory, as well as it's subdirectories. Print them tostdout
to 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
.txt
files. 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. - FILL IN THE BLANK:
I will use the blackfriday library. The documentation is located at https://github.com/russross/blackfriday. My goal is to use it to convert .md files to .html files.
- Add, commit, and push to GitHub.
- BEW 2.5: Project #1 - SSGs: Code samples you can use to complete the MVP requirements.
- BEW 2.5: Files & Directories: Code samples you can use to complete v1.1 requirements.
- BEW 2.5: Files & Directories: Code samples you can use to complete v1.2 requirements.