STATIC SITES SECTION: ---
1.What is static site generation?
Answer Using a program to produce HTML pages (kind of like compiling programs)
Middleman
2.what are the source files used in SSG?
Answer .md
.Erb
.scss
3.What is Middleman?
Answer A ruby Gem
the project is its own directory
lots of subdirectories for css,
images, etc Compile the
source files like a program can
then copy to any location
4.What are the three benefits of using a program for Static Site Generation?
Answer 1. Code reuse and single point of control (visual identity)
2.Authoring of content in a language that is more human-friendly (improved syntax)
3.Parameterized generation of markup and content (content generation)
, CSE 3901: MIDTERM 2 EXAM STUDY GUIDE
5. Describe Visual Identity (code reuse/single POC) Motivation
Answer -Having common headers and footers and making the whole website have a base
design for every page
-duplicated code ruins single POC
-Solution: putting common HTML in one file (a partial) and every page includes it
6. What is ERb?
Answer Embedded Ruby
-things like <% code %> <%= expr %> and <%# text %>
7. How to generate a site
Answer save source files as html.erb >> bundle exec middleman build this then makes them
.html
8. what is a partial
Answer a document fragment included in other documents
-include in template as <%= partial "navigation" %>
9. what is special about naming a partial?
Answer they always start with _ and end in .erb still (no html)
10. How to customize arguments with a partial
Answer in the normal page when you call the partial: <%= partial "banner", :locals => {
:name => "Syllabus", :amount => 34 } %> in the partial file:
, CSE 3901: MIDTERM 2 EXAM STUDY GUIDE
<h3> ,%= name %> </h3>
<p> Costs <%= "$#{amount}.00" %></p>
11. What is Layout
Answer It is a file that can make a consistent structure across every page in a website
12. How do you label where there's page specific stuff in Layout.erb?
Answer <%= yield =>
13. How do you fix the issue of using a layout when each page needs a diff
<title>?
Answer Ruby variable
current_page ie:
current_page.path
So in the actual page file you put:
<title><%= current_page.data.title %> </title>
and in the layout.erb:
---
title: "Contact Info"
---
14. What is the main difference in syntax when using middleman?
Answer Not having to use tags because that part is in layout