Your sites Log in Sign up Menu

How to add a new view with a tag as parameter

I want to add a second template page similar to the tagged pages, so I added in package.json:

  "views": {
    "tagged2.html": {
      "url": "/tagged2"
      "partials": {
        "title": "...",
        "description": "..."
      }
    },
    ...
  }

However this merely defines a URL http://myname.blot.im/tagged2 without parameters. That's why http://myname.blot.im/tagged2/mytag gives a 404.

So how can I define a new view/template page which accepts a tag name as parameter?


a year ago, 5 replies   developers   Improve this question

Unfortunately the tagged parameter in the path part of the URL only works in the tagged.html view right now. However, if you're willing to use a query string, this will work right now:

http://myname.blot.im/tagged2?tag=mytag

Eventually I'll add support for URL parameters in the template engine, so you'd be able to define something like this:

    "tagged2.html": {
      "url": "/tagged2/:tag"

If you'd like me to notify you when this is ready, please email us

Answered a year ago · Improve this answer

Thanks for your answer.

Query string is certainly good enough, but of course a URL parameter is even nicer. :-)

Answered a year ago · Improve this answer

Hi again, I've just tried it and created a tagged2 view.

However when I add the query string as you suggest (http://myname.blot.im/tagged2?tag=mytag) the structure entries is not populate in the JSON handed to the page nor does the variable tag appear in in the JSON.

The page appears as if there's no query string given.

Anything I miss?

Answered a year ago · Improve this answer

Hey, OP. Did you manage to solve this? Am trying to achieve something similar

Answered a year ago · Improve this answer

Actually, this only works for the tagged.html view right now, I'll follow up when it's possible to do this elsewhere

Answered a year ago · Improve this answer

Privacy Terms