The url structure of mywebsite should be like this:
/ - the index
/blog/ - a blogs index
/blog/post1
/blog/post2 - different posts
/blog/archive - the blogs archive
The structure in the directory content ist:
blog |-post1 |-post2
Since the blogs index is nothing but a first text about the blog, it can be treated as a post.(But there is no need to.) (But I would like not to change its url in cause of this).
That means: How to make:
one special blog entry being found at /blog/ (or at least one special markdown file)
and the normal list page from /blog/ being found at /blog/archive/
I tried to do this with [permalinks] in config.toml, but I didn’t get trough this.
Content here can be created at content/blog/_index.md, but keep in mind that this will list according to a list.html template and not a single.html template.
You’ll have to create a special layout for the archive. For example, layouts/blog/archive.html and then in the front matter of content/blog/archive.md, put the following (this is YAML, not TOML):
That’s not what I want to do. I want to have one post at this adress. I figured out how to do this: put url = "/blog/" in the meta information of that post. No problem here so far.
I would have to update that archive.md manually. That’s not what I want. I want a normal list page move to another adress as I did to the single post before. But here this doesn’t work.
In addition: when I create an _index.md file, the url-meta-information in the single post works no longer.
I want to move the content from _index.md to the adress /blog/archivewithout touching it physically.
Right. You can do that by having the content of your _index.md be that “special post.” As I mentioned, you will just need to create your list template for /blog/ so that it only pulls in the content of the file at content/blog/_index.md.
No, you wouldn’t. You would do this in the template you create…as I mentioned…
Ok, you’re right and I just don’t understand what you want to tell me - I am kind of noob in Hugo. Do you have some link to a tutorial where these archive layouts are explained?
Here is how to add content and front matter to list pages (i.e., any of your _index.md pages…and don’t forget the underscore). This will also help you with your forum question regarding first and last:
Also, after you give this a shot, please post a link to your source with any questions and I’ll try and give you some more concrete feedback on how you can get this done. Rest assured, you can do what you’re trying to do with Hugo…
So… I have to create a list page - for that I need no .md-file. Right? For that list page I will create a layout, called /layout/blog/archive/. Within that layout I can simply access the normal list pages variables, such as .Data.Pages, which have all posts stored (but only the posts, nothing else!) . Having this variable, I can create a normal list layout. Right?
So, there is only one question left:
How do I make that archive page render as a list page? (And having access to the posts?)
This is obviously just scaffolding for the archive…
1. Create a file at content/blog/archive.md with the following front matter:
---
title: Archive
date: 2017-05-26
description: Whatever description you want, assuming you are using `.Desription` for SEO/metadata/whatever.
type: archive
layout: archive
---
Whatever content you may or may not want to add to the page....
2. Create a layout at layouts/type/archive.html
<ul>
{{ range where .Site.Pages "Type" "blog" }}
<li>{{.Title}}</li>
{{ end }}
</ul>
That should hopefully get you started. Note that .Site.Pages also includes _index.md, which I did intentionally because you said you want that index page to be a “special post.” If you want to remove _index.md pages from the list, use .Site.RegularPages.