2

I can successfully create and run a basic Harp app locally and I can compile to html/css/js and run the homepage and index page on my blog however the article page paths are incorrect.

Locally the paths load as per the article slug, e.g. /articles/welcome-to-harp.md loads as /articles/welcome-to-harp

When compiled there are two issues:

  1. Separate folders for each article are not created, so I end up with /articles/welcome-to-harp.html. I can live with this if I have to - but is there a compile option to create a structure like /articles/welcome-to-harp/index.html?

  2. Links from both the homepage and article indexes point to /articles/welcome-to-harp when they should be pointing to /articles/welcome-to-harp.html as this is the compiled file structure (there is no file at /articles/welcome-to-harp in the compiled www folder)

Im using the kennethormandy/hb-remedy boilerplate and have made no changes. Node and Harp installs are brand new as of today.

Compiled project can be viewed here: http://blog.shapevoid.com/

Any way to resolve these two issues?

AstroCB
  • 12,337
  • 20
  • 57
  • 73

1 Answers1

2

The problem here is that the web server you are using in production isn’t giving you the extra helpers that are built into Harp.

As a web server, Harp gives you the extra features like allowing you to access welcome-to-harp.html at /welcome-to-harp—this is what’s happening when you’re using harp server. When you run harp compile, the pages you have in the file system are compiled to the same place.

If you’re planning on manually compiling for other web servers but still want pretty URLs, you can structure your pages that way:

/articles/welcome-to-harp/index.html

It’s possible we might add the implicit functionality you’re describing, we have an open PR for it, but right now Harp outputs the same directory structure you have setup when you run harp compile.

kennethormandy
  • 2,080
  • 14
  • 16