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?

5 replies

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 4 months ago · Improve this answer

Thanks for your answer.

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

Answered 4 months 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 4 months ago · Improve this answer

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

Answered a month 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 month ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 28 questions bug 14 questions posts 9 questions resolved 7 questions request 6 questions google-drive 5 questions configure 4 questions pages 3 questions added 3 questions meta 3 questions More tags →
Subscribe for changes
RSS Feed of latest questions