Skip to content

Editing Techniques

Luna edited this page Dec 10, 2019 · 2 revisions

Jekyll lets you write pages in either Markdown or HTML. You will probably find it easier to write pages in Markdown, unless you are already familiar with HTML. While HTML allows for greater control, it requires greater proficiency. Feel free to consult this Markdown Cheatsheet, or this HTML Cheatsheet.

You can use HTML in Markdown files, and vice-versa. The file extension determines what your main mode of writing will be. See the Editing Techniques doc for more info.

The following snippets and techniques may be relevant or helpful when working on posts:

Writing Markdown in HTML Files

Note: If you write Markdown code in a .html file (or an HTML section in a .md file), you'll have to run it through the markdownify filter. If you write HTML code in a .md file, you'll have to be careful about code indentation.

In the example below, a Markdown formatted link ([Link Name](https://url.com)) is run through the markdownify filter:

<p>Vist our {{ "[About page](http://somesite.org/about)" | markdownify }}</p>

Becomes:

Vist our About page

Writing HTML in Markdown Files

Normally when writing HTML, one would write something like the following:

<div class="entries">
  <ul class="entry-list">
    {%- for author in site.authors -%}
    <li><a class="post-link" href="{{ author.url | relative_url }}">{{ author.name }}</a></li>
    {%- endfor -%}
  </ul>
</div>

When writing in Markdown, you might have to collapse the indentation, so that the Markdown parser doesn't think you're rendering code sections.

Add Example Here

Linking to other local posts

Use the post_url tag to link to other posts without having to worry about the URLs breaking when the site permalink style changes. Example:

[Link text]({% post_url 2011-04-14-free-million-dollar-idea-package-carriers-b2b-success %})

Clone this wiki locally