mfioretti: hugo*

Bookmarks on this page are managed by an admin user.

24 bookmark(s) - Sort by: Date ↓ / Title / Voting / - Bookmarks from other users for this tag

  1. Implementing Static Comments on a Static Site!
    Voting 0
  2. Presentation can be handled in a variety of ways, from interactive JS frameworks like Angular, to static generators, to mobile apps, or even another CMS. Multiple frontends can peacefully coexist.
    Tags: , , , , by M. Fioretti (2017-05-11)
    Voting 0
  3. I found a more performant code snippet dropped last August. I've adapted it in After Dark to support conditional list display. Here's the end result:

    {{ range first 1 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
    {{ $.Scratch.Set "has_related" true }}
    {{ end }}

    {{ if $.Scratch.Get "has_related" }}
    <header>Related Content</header>
    {{ $num_to_show := .Site.Params.related_content_limit | default 7 }}
    {{ range first $num_to_show (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
    {{ end }}
    {{ end }}

    This uses uses range to loop over pages until it finds its first match, setting a Boolean in $.Scratch, which is then used to conditionally output 7 related pages, with optional limit override, in reverse chronological order (the Hugo default). Note this will grab pages across sections and not just posts.
    Tags: by M. Fioretti (2017-02-12)
    Voting 0
  4. There are plenty of as-yet undocumented features and options in Hugo (or so it felt when I was trying to solve various things), one of which is specifying the URL of your RSS feed. It’s not covered in the Configuration section, but you can add:

    rssURI = "feed"

    (If you’re using the TOML format, you’ll have to add the equivalent if using YAML.)

    This tells Hugo to output the RSS feed to:


    Which seems to work (I was trying to match WordPress’ path). Obviously put in rss.xml and you’ll get:


    I believe the default is index.xml if you don’t specify anything.
    Tags: , by M. Fioretti (2017-01-14)
    Voting 0
  5. rssuri: "atom.xml"
    Tags: by M. Fioretti (2017-01-14)
    Voting 0
  6. taxonomies » category = "category" tag = "tag"
    Tags: by M. Fioretti (2017-01-14)
    Voting 0
  7. Looking at your two links, I'm still a little confused as to what you're trying to do, but here is what I was able to glean from it:

    You have a markdown file with some content in it
    You want to have that chunk of markdown converted into HTML and added to several pages, but you want to be able to change it once (ie, within the markdown) and have it change everywhere

    If this is correct - and this is piggybacking on what Bjorn already mentioned - do the following, and I'm using the sample links you included in your original post:

    Take your markdown file. I assume it's called Copy that to layouts/partials/spec.html (note: you can keep it in markdown, but you'll need to change the extension to .html)
    In your template for a single page (for the sake of this thread, let's say it's the default single page layout living at layouts/_default/single.html), add {{partial "spec.html" | print | markdownify}} wherever you want the spec to fall in the source and check your browser.
    Looking at the spec.html you linked to, I don't know why you're interested in including this in multiple pages (not that I'm saying you shouldn't), so you may want to get creative with the front matter you include in individual markdown files (ie, pages) and then include something to the effect of include_spec: true in the front matter of your file and add a conditional to the templating: (eg, {{if .Params.include_spec }}{{partial "spec.html" | print | markdownify }}{{end}} I mention in #2.

    Does this answer your question?
    Tags: , by M. Fioretti (2017-01-09)
    Voting 0
  8. This was the hardest part of the learning curve for me. Layouts are the part of your codebase that specify how your content is turned into actual views in your static site. There is a correlation between the layout directories, and the type names we talked about previously. Because I have two types, “post” and “page”, it means I will have the corresponding locations within the layouts directory. Hugo has a resolution order it will use, when figuring out which layouts to apply. First it will check if there is a direct match for the type, and then it will fall back on a special “_default” directory. Within these directories, you can specify what content should look like when it is viewed as:
    Tags: by M. Fioretti (2017-01-06)
    Voting 0
  9. check it
    Tags: by M. Fioretti (2017-01-05)
    Voting 0
  10. This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I’ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won’t cover using CSS to style your theme.

    We’ll start with creating a new site with a very basic template. Then we’ll add in a few pages and posts. With small variations on that, you will be able to create many different types of web sites.

    In this tutorial, commands that you enter will start with the “$” prompt. The output will follow. Lines that start with “#” are comments that I’ve added to explain a point. When I show updates to a file, the “:wq” on the last line means to save the file.
    Tags: , by M. Fioretti (2017-01-05)
    Voting 0

Top of the page

First / Previous / Next / Last / Page 1 of 3 Online Bookmarks of M. Fioretti: Tags: hugo

About - Propulsed by SemanticScuttle