assemble / grunt-assemble-permalinks

Permalinks middleware for Assemble, the static site generator for Grunt.js and Yeoman. This plugin enables powerful and configurable URI replacement patterns, presets, uses Moment.js for parsing dates, and much more.
MIT License
43 stars 11 forks source link

Permalinks structure ignored #45

Closed ain closed 10 years ago

ain commented 10 years ago

I got permalinks running with i18n support nicely, but now in a "clean" way I have failed miserably.

Task:

    assemble: {
      options: {
        flatten: true,
        layoutext: '.hbs',
        assets: 'app/',
        layoutdir: '<%= yeoman.src %>/templates/layouts',
        partials: ['<%= yeoman.src %>/templates/partials/*.hbs'],
        data: ['<%= yeoman.src %>/data/*.yml'],
        plugins: ['assemble-contrib-permalinks']
      },
      pages: {
        options: {
          permalinks: {
            structure: ':section/:slug:ext'
          },
        },
        files: {
          'app/': ['src/templates/pages/index.hbs']
        }
      }
    }

src/templates/pages/index.hbs:


---
title: subindex
layout: default
section: about-us
slug: rebane

---
<main>Sub-page</main>

Result: app/index.html

doowb commented 10 years ago

What does your package.json file look like?

ain commented 10 years ago

package.json:

{
  "name": "...",
  "description": "...",
  "version": "0.1.1",
  "dependencies": {
    "time-grunt": "~0.1.2"
  },
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-sass": "~0.10.0",
    "grunt-contrib-jshint": "~0.8.0",
    "grunt-contrib-cssmin": "~0.7.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-htmlmin": "~0.2.0",
    "grunt-bower-install": "~1.0.0",
    "grunt-contrib-imagemin": "~0.5.0",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-rev": "~0.1.0",
    "grunt-autoprefixer": "~0.7.2",
    "grunt-usemin": "~0.1.10",
    "grunt-mocha": "~0.4.10",
    "grunt-modernizr": "~0.5.1",
    "grunt-svgmin": "~0.3.1",
    "grunt-concurrent": "~0.4.3",
    "time-grunt": "~0.2.9",
    "grunt-contrib-compress": "~0.6.1",
    "grunt-newer": "~0.6.1",
    "grunt-replace": "~0.6.2",
    "assemble": "~0.4.36",
    "jit-grunt": "~0.2.1",
    "assemble-contrib-permalinks": "~0.3.4",
    "grunt-browser-sync": "git+https://github.com/interactive-pioneers/grunt-browser-sync.git#35788f11c4bff68c6c08fe94804586e261272360"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "repository": {
    "type": "git",
    "url": "https://...:4442/git/....git"
  }
}

I have another project with almost identical setup where it works in conjunction of assemble-contrib-i18n.

doowb commented 10 years ago

Add a keywoards array with "assemble-contrib-permalinks" in it...

"keywords": [
  "assemble-contrib-permalinks"
]
ain commented 10 years ago

That's the weirdest suggestion of the week, but no, it does not help anyhow!

Do you think it's installation error?

ain commented 10 years ago

Module is installed properly, version claims 0.3.4. Must be about how the task is defined.

doowb commented 10 years ago

That's the weirdest suggestion of the week

Lol... well that's one of the requirements for helpers in other modules so I thought it might be the same. I think everything else looks correct. Since it looks like you're only using the permalinks plugin in your target, you should probably open this issue on that repository.

ain commented 10 years ago

Further discussion in #46.

jonschlinkert commented 10 years ago

That's the weirdest suggestion of the week,

I've seen worse. But it's not new to us, we got the idea from Grunt itself. But it's up to you, you can either register the helper explicitly in the task options, or you can use the shortcut that @doowb offered.

doowb commented 10 years ago

Weird... I thought this was originally on the i18n repo. Sorry for asking to move it.

jonschlinkert commented 10 years ago

lol I didn't even notice that