11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.68k stars 484 forks source link

Page without content only shown on a collection list #206

Closed octoxalis closed 5 years ago

octoxalis commented 5 years ago

Well, almost without content: I mean only a short description for a link to an outside website. This description and the link are taken from the page front matter but there is no real content markdown. However, if there is no permalink in my front matter, 11ty generates an index page under /content/posts/mypage/index.html.

How can I tell 11ty to list my page in the posts collection but not create a specific page I do not need? For instance:

---js
{
layout:    'layouts/post/item.njk',
permalink: '',
linkto:    ''https://github.com/11ty/eleventy,
tags:      [ 'posts' ],

title:     "A new tasty static site generator",
subtitle:  `I'm found of 11ty`,
author:    "Octoxalis",
date:      "2018-08-17",
hdates:     "17 Août 2018",
abstract:  `11ty is a new player in the jungle of static site generator which deserves much more than a glance. Have a look an enjoy!`,
comments:  true
}
---
[comment]: # (No real content, this is a short description for a link to 11ty website)

According to the permalink doc page I could put in my front matter something like:

permalink: '.garbage/nopage.html',
permalinkBypassOutputDir: true,

But may be we could have only a directive like:

permalink: none

to avoid generating the page.

jevets commented 5 years ago

Similar to my #204

My conclusion so far is that I'll have to parse these markdown files separately and generate data files from them (probably .json). Or I could go ahead and generate the pages, then use a post-build task of some sort to empty that directory (.garbage) in your case.

The docs do mention a way to generate files into _includes that other templates can use... maybe there's a way to use that feature in these use cases.

(edit https://www.11ty.io/docs/permalinks/#ignore-the-output-directory)

I haven't figured out a route yet, though.

zachleat commented 5 years ago

I think this is a duplicate of #61 (and tangentially related to #188)? Do you agree with that?

I kinda like the idea of a permalink: false there too

octoxalis commented 5 years ago

I do agree, it's the same "option" and permalink: false is better than permalink: none as it's in accordance to other front matter values.

zachleat commented 5 years ago

Awesome. We’ll follow along over at #61.