--- title: Documentation author: Alex Gil featured_image: screenshot-home.png --- ## Contents {{< toc >}} --- ## Prerequisites This documentation was built with beginners in mind, but has the necessary information for more seasoned producers. To install and use Ed you will be using your terminal. If you need a refresher, I highly recommend "[The Command Line Crash Course](https://www.computervillage.org/articles/CommandLine.pdf)." Working knowledge of HTML and CSS is also taken for granted. If you're new to HTML and CSS, you may want to check out the relevant courses on [codecademy.com](https://www.codecademy.com/learn/web). --- ## Installing Ed Before starting, please be sure that you have [installed Hugo](https://gohugo.io/getting-started/quick-start/#step-1-install-hugo) and [created a new site](https://gohugo.io/getting-started/quick-start/#step-2-create-a-new-site). After that, you are ready to install Ed. The first step to install Ed is to download the source files from GitHub. To do so you must have git installed on your computer. You probably have git already, but if you don't, the easiest way is probably to install [Github Desktop](https://desktop.github.com/) (even though we will be using git and github from the terminal in this tutorial). Mac users may want to ensure they have [Xcode](https://developer.apple.com/xcode/) and its command line tools installed as well. To check if git is running on your system enter the following line on your terminal (remember to ignore the $): ~~~ bash $ git --version ~~~ If you don't get an error, you're good to go. Using the `cd` command on your terminal, navigate to the folder where you keep your web projects. Once you're in the folder where project live, download it from github using the following line (remember you can copy and paste): ~~~ bash $ git clone https://github.com/sergeyklay/gohugo-theme-ed.git themes/ed ~~~ Or, if you don't plan to make any significant changes but want to track and update the theme, you can add it as a git submodule via the following command: ~~~ bash $ git submodule add https://github.com/sergeyklay/gohugo-theme-ed.git themes/ed ~~~ --- ## Getting started After installing the theme successfully it requires a just a few more steps to get your site running. --- ### The config file Take a look inside the [`exampleSite`](https://github.com/sergeyklay/gohugo-theme-ed/tree/master/exampleSite) folder of this theme. You'll find a file called [`config.toml`](https://github.com/sergeyklay/gohugo-theme-ed/blob/master/exampleSite/config.toml). To use it, copy the [`config.toml`](https://github.com/sergeyklay/gohugo-theme-ed/blob/master/exampleSite/config.toml) in the root folder of your Hugo site. Feel free to change the strings in this theme. You may need to delete the line: `themesDir = "../.."`, because it's necessary only for theme developers. Also, make sure the theme option is set to `ed`: ~~~ toml theme = "ed" ~~~ To see if Ed is working properly we will take advantage of Hugo's built in server. You can build the first version of your site and run the Hugo server at the same time by entering: ~~~ bash $ hugo server ~~~ Copy the url from your terminal log and paste it into your browser of choice. This url usually looks something like this `http://localhost:1313`. At this point you should be looking at your very own working version of Ed: {{< img src="screenshot-home.png" alt="Your very own Ed" >}} --- ## Hugo Ed is a Hugo theme. That means you will need some familiarity with Hugo to take advantage of its full potential. While running a Hugo site is a bit more involved than Wordpress and other similar tools, the payoff in the long term is worth the effort to learn it. If you are new to Hugo, I recommend you take a look at [A Guide to Using Hugo](https://strapi.io/blog/guide-to-using-hugo-site-generator) at *Strapi*, [Host on GitHub](https://gohugo.io/hosting-and-deployment/hosting-on-github/) on *Hugo Documentation Site* and [Hugo's own documentation](https://gohugo.io/documentation/) to start getting a sense of how it works. Once you have gone through these tutorials, you can get started using Ed. Remember to always and only edit content files for your site using [a plain text editor](https://en.wikipedia.org/wiki/Text_editor), and *not* a word processor. I'm composing this file using a plain text editor called [Visual Studio Code](https://code.visualstudio.com/). You should make sure that all your texts have the YAML front matter (the information at the top of the file). YAML stands for "YAML Ain't Markup Language" --- no disrespect to XML --- and it's the main way that Hugo handles named data. Here's an example of YAML front matter: ~~~ yaml --- title: "Cahier d'un retour au pays natal" author: Aimé Césaire draft: true --- ~~~ --- ## Markdown and CommonMark Ed is designed for scholars and amateur editors who want to produce either a clean reading edition or a scholarly annotated edition of a text. The main language we use to write in the Hugo environment is called Markdown. To learn more about the Markdown family, see Dennis Tenen and Grant Wythoff's "[Sustainable Authorship in Plain Text using Pandoc and Markdown](http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text-using-pandoc-and-markdown)." By default Hugo uses a special Markdown processor called Goldmark. The processor can be said to use it's own 'flavor' of Markdown called CommonMark, and sometimes the Markdown syntax will be different than other flavors of Markdown. CommonMark is a rationalized version of Markdown syntax with a spec whose goal is to remove the ambiguities and inconsistency surrounding the original Markdown specification. It offers a standardized specification that defines the common syntax of the language along with a suite of comprehensive tests to validate Markdown implementations against this specification. You can become familiar with the CommonMark syntax in the [CommonMark documentation](https://spec.commonmark.org/). Another way to become familiar is to examine the sample text source files we provided. --- ## Genres Ed offers three different layouts: poem, narrative and drama. To create content of a certain genre, create a file in the appropriate folder. For example, if you want to create a poem, create a file in the `content/poem` folder. Another way is to indicated genre in the YAML front matter on your texts. The templates that govern how these genres are displayed can be found in the Ed's `layouts` folder. Redefining these layouts in project wide level will allow you to tweak the stylesheets according to your different needs. Out of the box, Ed contains some special instructions for poetry in its stylesheets that allow you to deal with some of the peculiarities of poetry layouts. To indicate lines in poetry we use the line syntax from Markdown: ~~~ markdown - Hold fast to dreams - For if dreams die - Life is a broken-winged bird - That cannot fly. - Hold fast to dreams - For when dreams go - Life is a barren field - Frozen with snow. ~~~ The `-` at the beginning of each line indicates that these are lines. Another way to achieve the same effect is to use the following syntax: ~~~ markdown Hold fast to dreams\ For if dreams die\ Life is a broken-winged bird\ That cannot fly.\ Hold fast to dreams\ For when dreams go\ Life is a barren field\ Frozen with snow. ~~~ To indent specific lines we take advantage of Hugo shortcuts that allows us to create empty indentation for a line. This approach still allows the line to be readable while editing. ~~~ markdown - {{* indent 3 */>}} But O heart! heart! heart! - {{* indent 4 */>}} O the bleeding drops of red, - {{* indent 5 */>}} Where on the deck my Captain lies, - {{* indent 6 */>}} Fallen cold and dead. ~~~ or: ~~~ markdown {{* indent 3 */>}} But O heart! heart! heart!\ {{* indent 4 */>}} O the bleeding drops of red,\ {{* indent 5 */>}} Where on the deck my Captain lies,\ {{* indent 6 */>}} Fallen cold and dead. ~~~ The `{{* indent 3 */>}}` is what we need to in order to indicate the indent value for that line. Values can range from 1-10. You can expand the range or adjust the values in the custom stylesheet file. Ed is customized by creating stylesheet files in `assets/css/extended/*.css` at project wide level. The example from Raisin in the Sun shows us that we don't need much special markup for theater as long as we use CAPITAL LETTERS for speakers. Italics for directions are easy enough. Just use `*` around the words you want to italicize. *Narrative of the Life of Frederick Douglass* shows us an example of narrative that includes footnotes and quoted poetry. See the sections below for how to accomplish these different effects. --- ## Footnotes Footnotes are the bread and butter of scholarship. Hugo makes footnotes a fairly simple affair: ~~~ markdown - O Captain! my Captain! rise up and hear the bells; - Rise up—for you the flag is flung—for you the bugle[^1] trills, ... [^1]: The bugle is a small trumpet implicated in the military industrial complex. ~~~ These footnotes can be placed anywhere, but they will always be generated at the bottom of the document. To have a multi-paragraph footnote you need to start the footnote text on the next line after the footnote anchor and indent it: ~~~ markdown [^1]: Ugh pinterest fixie cronut pitchfork beard. Literally deep cold-pressed distillery pabst austin. Typewriter 90's roof party poutine, kickstarter raw denim pabst readymade biodiesel umami chicharrones XOXO. ~~~ Please note, you need to indent all lines at the same level to make them stay inside the footnote. At the moment (May 2022) time the footnotes system provided by Hugo does have one limitation: It does not support non-numbered footnotes, and it only allows you to have one set of footnotes for a text. In some cases we have to separate the author's footnotes from our own, in others we want to represent the author's own footnote style. In these cases we have to use custom Ed's shortcode for footnotes. Here's the example from *Narrative of the Life*: ~~~ markdown ... At this time, Anna,{{* footnote "fn2" */>}} my intended wife, came on; ... {{* footnotesList */>}} ... {{* citation "fn2" "She was free." */>}} ... {{* /footnotesList */>}} ~~~ --- ## Blockquotes *Narrative of the Life* also includes several blockquotes. You can also find another example of blockquote use in the footnote of "O Captain! My Captain!" Simple blockquotes are simple enough in Markdown: ~~~ > This is to certify that I, the undersigned, have given the bearer, my servant, full liberty to go to Baltimore, and spend the Easter holidays. > > Written with mine own hand, &c., 1835. > WILLIAM HAMILTON, ~~~ To use a line break in block elements add two spaces after the end of the line where you want the break. You can't see them after `&c., 1835.` but they are there. Things get a bit complicated when we want to use poetry inside the block or when the block is included in another block element, like a footnote. Here's the last two stanzas from "A Parody" in *Narrative of the Life*, which shows an example of a blockquote of poetry: ~~~ ... > - Two others oped their iron jaws, > - And waved their children-stealing paws; > - There sat their children in gewgaws; > - By stinting negroes' backs and maws, > - They kept up heavenly union. {.poetry} > - All good from Jack another takes, > - And entertains their flirts and rakes, > - Who dress as sleek as glossy snakes, > - And cram their mouths with sweetened cakes; > - And this goes down for union. {.poetry} ~~~ The `{.poetry}` tag at the end tells the processor to think of the lines above it as poetry. The `{.poetry}` tag is an example of Goldmark class assignments for block-elements. Because this segment of poetry exists in the 'narrative' layout, and because it is part of a blockquote, we need to signal to the processor to process poetry this way, so that the right class is invoked in the stylesheet. The good news is this is the most complex Goldmark syntax layout you will encounter in Ed. ## Pages Your editions are treated as [sections](https://gohugo.io/content-management/sections/) or [page bundles](https://gohugo.io/content-management/page-bundles/) in Ed. Other web pages in your site exist outside the `content` folder. Default homepage, for example, is constructed from the `index.html` file found on the `layouts` folder of Ed theme. You will notice that the homepage in particular has a `.html` file ending instead of a `.md` ending. All template files in Hugo are HTML, and the index behaves as a template file. Although these files are mostly written in HTML, notice that they may contain [template tags](https://gohugo.io/templates/introduction/). To create your own homepage create `index.html` file in project `layouts` folder, making sure that your changes to `index.html` are written in valid HTML. The same goes for all Ed's template files in the `layouts` folder. --- ## Tables of Content You will find three kinds of Tables of Content in Ed. The first example is in the list of Latest Publications in the Homepage. This list is generated using the [templating language](https://gohugo.io/templates/introduction/). This is one of the major components of Hugo, and I recommend you deepen your knowledge of it if you want to modify the logic that automates much of Ed. Here is the code that generates the Latest Publications list on the homepage: ~~~ html