zirafa / pushtape-cassette

A lightweight framework for building static music apps. Make a cassette.json of your music and render a complete music site in seconds, featuring a persistent music player.
http://pushtape.com/demo/cassette/
MIT License
25 stars 8 forks source link

Error with handling baseURL #1

Closed Sakrecoer closed 8 years ago

Sakrecoer commented 8 years ago

When pushcasette is put into a subfolder, for example /discography/, and the links in the pushcassette-menu are edited in cassette.json to send you to a page such as /about/, the menu sends you to /discography/about/, even if the baseURL is edited accrodingly in the index.html file. Also the logo sends you back to the "release page" instead of the (root) of the site.

I also tried to set the homePage value in cassette.json to / but it returns a broken pushcassette.

However, this is looking awesome! I love it so far!

zirafa commented 8 years ago

Hmmm...does the site load at all (or do you get missing css/js)? Can you post what you have in your cassette.json? It's possible you might have some server side caching going on, try and view source on your index.html in the browser to confirm the baseURL actually changed.

I don't think you can set homePage to / as homePage is basically a redirect for /. The homePage path must exist as a JS route (not a server path). What were you expecting to happen by setting homePage to / ?

Sakrecoer commented 8 years ago

The site loads, no error (unless i change the homePage value, then it loads but no release to be seen)

Here is how the cassette.json looks:

{
  "lastBuild": {},
  "settings": {
    "homePage": "releases",
    "cleanURLs": false
  },
  "pages": {
     "releases" : {},
     "about" : {"location" : "/about/"},
     "radio" : {"location" : "/radio/"}
  },
  "releases": {
    "example-release": {
      "title" : "Cosmic Voyage",
      "playlist" : "releases/example-release/tracklist.jspf",
      "artwork" : "releases/example-release/artwork.jpg",
      "notes" : "releases/example-release/notes.md"  
    },
    "example-release-two": {
      "title" : "Bird Life",
      "playlist" : "releases/example-release-two/tracklist.jspf",
      "artwork" : "releases/example-release-two/artwork.jpg",
      "notes" : "releases/example-release-two/notes.md"  
    }
  }
}

Yes, the baseURL actualy changed, no server caching going on.

I want to have pushcassette in a subfolder, i want the visitor the be able to go back to the main site and the rest of the main sites sections via the pushcassette menu.

zirafa commented 8 years ago

Aha, I think I see the problem. The issue is that the location path for pages expects to see a file, such as /pages/about.md. which gets loaded when you go to /about. If instead you'd like to redirect to root/about/ you probably don't want to use the generated JS menu. In that case, you can just create a regular HTML list in index.html with relative server paths. To get the logo and site name to link to root/ just remove the data-navigo attribute on them (the navigo JS routing library works by hijacking links to make them load using JS).

Sakrecoer commented 8 years ago

ah! awesome! :) thank you! :)

zirafa commented 8 years ago

Thinking on this some more - it might be nice to be able to redirect to server paths within cassette.json...maybe a type="external" attribute might allow for more mixed / flexible menus.

Something like:

type="internal" (load markdown file via AJAX)
type="external" (treat as a normal path)

Potential for confusion there, but I can see wanting to add a link to Soundcloud or Bandcamp or something and an option like that might make life much easier.

Sakrecoer commented 8 years ago

@zirafa : i just need to big you up; your dedication and attention to detail is remarkable! You are a blessing for all computer-literate musicians!

zirafa commented 8 years ago

thanks!