# Easy markdown to website

**URL:** <https://zola.discourse.group/t/easy-markdown-to-website/1845>\
**Category:** Feature requests\
**Created:** [August 24, 2023, 7:02am UTC](https://zola.discourse.group/t/easy-markdown-to-website/1845 "2023-08-24T07:02:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itf](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/itf/32/1062_2.png) [@itf](https://zola.discourse.group/u/itf)\
**Post date:** [August 24, 2023, 7:02am UTC](https://zola.discourse.group/t/easy-markdown-to-website/1845/1 "2023-08-24T07:02:55Z")

</div>

I wanted to be able to generate a website from my markdown files using zola without having to modify the markdown files ( no adding @/ on the links nor changing file locations, etc) . This way I could reuse markdown editors such as obsidian to manage links and assets.

To do this I had to find a solution to issue #877 [making links to relative assets work,](https://github.com/getzola/zola/issues/877) without your file having to be named index.md, [linking to internal content in non-markdown content](https://zola.discourse.group/t/linking-to-internal-content-in-non-markdown-content/320) and that links to .md files do not get translated into links to .md files unless you add @/ in front.

So I added 2 features to my local build:

ugly-urls: if set `ugly_url = true` on config.toml, `file.md` gets mapped to `file.html`. However `index.md` still behaves as is: a link to `foo/index.md` becomes a link to `foo/` so that people can force the pretty urls by explicit using index.md. This fixes the issue #877 as now the relative link of files is valid. It also makes link work from non markdown content, as the structure is preserved.  
It makes all assets in the same parent folder be page assets, even if the page is not called index.md. This doesn’t cause any new issues or causes files to collide, because it just preserves the current structure. However this can be problematic when there are permalinks to different folders.(28 lines in 4 files)

md\_local\_link: if set `md_local_link` on config.toml , any non external link that ends in .md is parsed as a local link. This way [file](file.md) becomes a link to (Path generated by file.md) , and gets properly checked. The behavior is the same as [file](@/file.md), except that it also handles relative links, even with ugly-url turned off. (16 lines in 2 files, could likely be shorter though)).

And I changed the behavior of specifying page paths on the page meta: if you specify `path = file.html`, it will generate `file.html` rather than `file.html/index.html`, and if you specify `path = file/`, with a final slash, it generates `file/index.html` even if using ugly-url, so you can override the default behavior for specific pages independent of the url mode.

I’d like to submit a pull request if any of these features could be useful. If they could be, should I split those features into separate PRs? Some posts requesting this are: [Making clickable links and viewable images in editor](https://zola.discourse.group/t/making-clickable-links-and-viewable-images-in-editor/1046), [#686](https://github.com/getzola/zola/issues/686), [#877](https://github.com/getzola/zola/issues/877) ,[#2271](https://github.com/getzola/zola/issues/2271) and [#840](https://github.com/getzola/zola/issues/840)

---

<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:** [August 24, 2023, 3:29pm UTC](https://zola.discourse.group/t/easy-markdown-to-website/1845/2 "2023-08-24T15:29:04Z")

</div>

I don’t think we want either in Zola:

1. ugly-urls: I don’t like the concept and it’s probably never going to get in Zola. There’s no reason if you want ugly\_urls to only have them sometimes, eg if you have colocated assets. Then you have different behaviours for trailing slashes, eg /foo will be /foo.html and /foo/ will be /foo/index.html (if the webserver even supports such redirects). To solve #877 correctly , you would need to copy the assets for every .md files in the directory otherwise you can have broken links. This is obviously opinionated but is something that could live in a fork if people really want it, not in the project itself.

2. Adding the @/ prefix is intentional, we don’t want to conflate zola internal links with relative links since we cannot validate links (some people are adding files from other sources after the zola build and we don’t want to error because of that.

---

<div class="post-metadata">

**Author:** ![itf](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/itf/32/1062_2.png) [@itf](https://zola.discourse.group/u/itf)\
**Post date:** [August 25, 2023, 12:53am UTC](https://zola.discourse.group/t/easy-markdown-to-website/1845/3 "2023-08-25T00:53:00Z")

</div>

if I’m allowed by work, I’ll maintain a fork with those features. It might take a couple weeks for me to get authorization though. I’ll update here when this happens.

Here is a link to the patch: [Comparing getzola:master...itf:easy-markdown · getzola/zola · GitHub](https://github.com/getzola/zola/compare/master...itf:zola:easy-markdown)
