# How do I duplicate an old directory structure with pages ending in .html?

**URL:** <https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114>\
**Category:** Support\
**Created:** [May 27, 2019, 3:50pm UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114 "2019-05-27T15:50:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cr1901](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@cr1901](https://zola.discourse.group/u/cr1901)\
**Post date:** [May 27, 2019, 3:50pm UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/1 "2019-05-27T15:50:33Z")

</div>

Hello all,

I have a [website](https://www.wdj-consulting.com) that’s in sore need of a refresh, so I’m [test driving](https://github.com/cr1901/website2) Zola as a replacement.

My old scheme was organically grown writing raw HTML and m4 macros. This was fun to do at the time, but I got sick of the fragile build system. One difference I’ve noticed between my old homegrown system and Zola is that I made heavy use of pages ending with .html, whereas Zola does _not_ end webpages with .html. My intent was to preserve the directory and filename structure so previous links to my website across the internet don’t break.

I learned about `aliases` in front-matter earlier today, but try as I might, I am unable to get aliases to work in at least two capacities:

1. My blog on my deployed website exists at (link limit) `https :// www . wdj-consulting . com / blog.html`. Since I want to use the functionality, I use a Zola section to sort all the blog posts under `content/blog`; sections do not have a concept of an alias, so I can’t map `content/blog/_index.md` to `http://127.0.0.1:1111/blog`.  
To remedy this, I tried creating a `content/blog/index.md` with a template that appends  
`section.content`, with `render = false` in `content/blog/_index.md`, but apparently the template doesn’t have access to `section.content` for some reason (I don’t have an example of this to share, it’s possible I messed up setting this up properly).

2. I created a dummy `content/blog/hello.md` post, which shows up under `blog/hello`, since Zola creates an `index.html`. I am unable to get Zola to generate a redirect with the following `aliases` front matter:

```auto
aliases=["hello.html"]

```

I would expect a redirect from `http://127.0.0.1:1111/blog/hello.html` to `http://127.0.0.1:1111/blog/hello`, but Zola does not generate such a redirect and instead emits a 404.

Assuming I want to take advantage of Zola sections to automatically sort blog posts, and make sure that the remaining blog posts original locations are still valid (even via redirect), what options do I have to make Zola preserve my old directory structure?

---

<div class="post-metadata">

**Author:** ![cr1901](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@cr1901](https://zola.discourse.group/u/cr1901)\
**Post date:** [May 27, 2019, 10:08pm UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/2 "2019-05-27T22:08:00Z")

</div>

Okay in my contrived `hello.md` post, if I want a redirect from `http://127.0.0.1:1111/blog/hello.html` to `http://127.0.0.1:1111/blog/hello`, I need to do `aliases=["blog/hello.html"]`.

However, `aliases=["hello.html"]` still does not generate a redirect. Based on my current understanding, a redirect page from `http://127.0.0.1:1111/hello.html` to `http://127.0.0.1:1111/blog/hello` should be generated, but Zola does not generate such a redirect. Why is that?

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [May 29, 2019, 9:01am UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/3 "2019-05-29T09:01:12Z")

</div>

This is weird, trying it on the zola docs it does work. I get:

```auto
<!DOCTYPE html>
<html>
    <head>
        <link rel="canonical" href="https://www.getzola.org/documentation/content/linking/" />
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta http-equiv="refresh" content="0;url=https://www.getzola.org/documentation/content/linking/" />
    </head>
</html>

```

when in `public/hello.html` when adding an alias to the linking doc. Do you have the repo up somewhere?

---

<div class="post-metadata">

**Author:** ![cr1901](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@cr1901](https://zola.discourse.group/u/cr1901)\
**Post date:** [May 29, 2019, 11:42am UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/4 "2019-05-29T11:42:24Z")

</div>

> Do you have the repo up somewhere?

Sure. I do have the repo up [here](https://github.com/cr1901/website2). `hello.md` is [here](https://github.com/cr1901/website2/blob/master/content/blog/hello.md).

I’m not sure what happened, but as of this morning, the alias for `hello.html` started working. As of matter of fact, I _removed_ the extra alias to “blog/hello.html” _without stopping the Zola binary_, and that alias still works after Zola regenerates the site. It seems that Zola only will honor changes in aliases for me when I fully stop and restart the binary. Is this the correct/intended behavior (but perhaps I missed it in the documentation)?

Btw, here is some relevant system information that I forgot 🙂

```auto
William@William-THINK ~/prj/Consult/website2
$ zola -V
zola 0.7.0

William@William-THINK ~/prj/Consult/website2
$ uname -a
MSYS_NT-6.1-7601 William-THINK 3.0.7-338.x86_64 2019-05-24 10:50 UTC x86_64 Msys

William@William-THINK ~/prj/Consult/website2
$ rustc -V
rustc 1.36.0-nightly (8869ee03d 2019-05-23)

```

Secondly, how should I handle an alias to `blog.html` if sections cannot have aliases? Is this a feature that can be possibly added in a limited capacity for people like me 😛?

---

<div class="post-metadata">

**Author:** ![cr1901](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@cr1901](https://zola.discourse.group/u/cr1901)\
**Post date:** [May 30, 2019, 4:11pm UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/5 "2019-05-30T16:11:09Z")

</div>

> [@cr1901](#):
>
> Secondly, how should I handle an alias to `blog.html` if sections cannot have aliases? Is this a feature that can be possibly added in a limited capacity for people like me 😛?

For now, I’ve just put a rewrite rule on the nginx server for this. That way, people with the old link to my blog can still access it while I transition to the `index.html`-only way of how Zola does things. Not exactly ideal for me, but it’ll do for now.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [May 30, 2019, 5:50pm UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/6 "2019-05-30T17:50:39Z")

</div>

Aliases can be added to sections and it should be easy to implement.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [June 2, 2019, 6:21pm UTC](https://zola.discourse.group/t/how-do-i-duplicate-an-old-directory-structure-with-pages-ending-in-html/114/7 "2019-06-02T18:21:27Z")

</div>

I’ve added `aliases` to sections, it will be there in 0.8.0
