acetate icon indicating copy to clipboard operation
acetate copied to clipboard

Issues building pages with custom urls

Open hhkaos opened this issue 6 years ago • 4 comments

Hi @patrickarlt & @paulcpederson !,

I'm starting with Acetate and I don't know how I can properly build my site.

E.g.: when I run node -e \"require('grunt').tasks(['deploy']);\" my page landing.html with:

---
title: ArcGIS Configurable Apps
description: Repository of custom configurable apps and templates
layout: layouts/_layout:main
url: '/'
---

<div class="block-group block-group-4-up tablet-block-group-2-up phone-block-group-1-up" id="products"></div>

<script src="/assets/js/landing.js"></script>

Instead of been on build/index.html it ends on build/landing/index.html.

The same thing happens with all the other pages, so... do I need to add something to my acetate.config.js?


I'm also having some issues with Grunt running the start script, but at least I found a workaround ^_^

hhkaos avatar Jul 12 '17 05:07 hhkaos

I have just found that if I also use the dest helper I can specify the output during the build process. I guess I can add something in the acetate.config.js that use the 'url' value + index.html so I don't need to add all of the manually, right?

I have been trying but I'm not sure if the I should use:

acetate.transform('**/*.+(md|html)', function (page) {
...
}

I tried using the acetate.debug inside that function and I didn't see any message so I'm not sure when it runs.

Thanks

hhkaos avatar Jul 12 '17 06:07 hhkaos

@hhkaos Acetate assumes that you will be using directory indexes on your server and will automatically prettify URLs. By default Acetate will also mirror the structure of your src folder to your dest folder. This means that:

Acetate assumes the URL of your landing.html page should be /landing/. In order to make that work Acetate builds it to landing/index.html which can then be served at /landing/ by any web server that supports directory indexes, which is on by default in pretty much every service ever.

If you want to actually create the root page of your site you just need to make a page that is index.html and acetate will prettify the URL and serve it at /.

patrickarlt avatar Jul 27 '17 16:07 patrickarlt

Aha, but I mean, I can use the dest helper as you can see here to avoid mirroring, right? Like I de here.

I'm not sure if I'm using the url and the dest helpers properly because they almost have the same value. Am I?

Thanks!

hhkaos avatar Jul 27 '17 17:07 hhkaos

@hhkaos in general you should not set url or dest Acetate will automatically determine then based on where you put the page in your source folder. So if you want the page /products/buy/ then you should make the page src/products/buy.html or src/products/buy/index.html and Acetate will figure the rest out.

I don't have a lot of tests around overriding dest and url manually so if you choose to manually override them you might run into some weird behavior and I wont guarantee that overrides like this will be supported in future versions, in fact it probably won't be.

If you still really want to override dest and url then yes you are responsible for keeping them both in sync and mirroring each other properly.

patrickarlt avatar Jul 27 '17 17:07 patrickarlt