Leahcim
Leahcim

Reputation: 41949

is it possible to create a layout/application.html file in a static site?

Is there a way to use a layout page for Github pages site? For example, if I have a site with index.html, about.html, and contact.html, there is going to be some content that doesn't change across each of these pages (for example, navigation or Google analytics). In a Rails site, for example, the content that remains the same can be kept in layouts/application.html.erb so that you don't have to repeat it in every page. Is there a way to do this with a static site?

Upvotes: 1

Views: 108

Answers (2)

Petah
Petah

Reputation: 46040

There are tools (which you might not like) such as Dreamweaver that can automate this. Otherwise what we do is write scripts to convert our PHP files to static html files.

php about.php > about.html

Upvotes: 0

Chuck
Chuck

Reputation: 237060

Yes, Jekyll has layouts. Put your layouts in a _layouts directory at the top of your static site. Use the {{ content }} tag in your layout where the page content goes. Then, in your YAML front matter, put a layout: default (or whatever layout you want to use).

https://help.github.com/articles/using-jekyll-with-pages

Upvotes: 3

Related Questions