Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Tag pages #2111

Closed
ErisDS opened this issue Feb 3, 2014 · 7 comments · Fixed by #2185
Closed

[Feature] Tag pages #2111

ErisDS opened this issue Feb 3, 2014 · 7 comments · Fixed by #2185
Assignees
Milestone

Comments

@ErisDS
Copy link
Member

ErisDS commented Feb 3, 2014

Tag pages allow the for the browsing of posts which have a particular tag, by visiting the route:

/tag/:slug/

Where :slug is the slug of a particular tag.

The tag page will provide the template with a paginated set of posts for the given tag, which can be accessed via {{#foreach posts}} in exactly the same way as the standard post list is rendered using index.hbs.

Additionally, tag pages will provide the template with all the data for the given tag such that it can be accessed by the tag via {{#tag}} in the same style as the post.hbs template.

The new tag controller will support a template/view hierarchy much like page.hbs > post.hbs. If there is a template called tag.hbs this will be used to render the page, otherwise tag pages will use the standard index.hbs which lists out posts.

Note: for this to be truly useful, there are some changes need to some of our handlebars helpers as covered by #2112

Note: for users to really love this feature, they're going to need to be able to manage their tags - delete unused ones, edit descriptions, etc. This will come along in #2119

@hswolff
Copy link
Contributor

hswolff commented Feb 3, 2014

I'd love to tackle this. I really want it in my blog so that passion will drive my work. =D

@JohnONolan
Copy link
Member

Addendum to this: If would be very good if the /tag/ slug could be configurable (maybe via UI later, but initially only programatically) - to allow people to choose how they would like this to appear. It could be anything:

site.com/tag/pencils/ or site.com/collection/pencils/ or site.com/category/pencils/

NB: I don't fully understand all of the nuances around dynamically adding/removing reserved routes - so - if this is outside the scope of 0.5, it can wait.

@mpancorbo
Copy link

I usually lurk on the effort of the developers, but this time I'd like to put some ideas on the table.

Be ready to deal with:

  • tags with spaces ("British Museum")
  • tags with unusual symbols ("Black&White")
  • tags with non-ascii characters ("Castellón")
  • uppercase equals lowercase? "London" = "london"?

Thanks for your brave work!

@hswolff
Copy link
Contributor

hswolff commented Feb 6, 2014

Great examples to use for tests. Thanks @mpancorbo!

@MoriTanosuke
Copy link

Wow, this is actually the one feature I really miss from the 0.4.x releases. I started using tags, but the sad gray words definitely need hyperlinks to those tag pages! 👍 for @hswolff

hswolff added a commit to hswolff/Ghost that referenced this issue Feb 18, 2014
fixes TryGhost#2111

- modified Post model to support a tag query
  param that will filter the desired post collection
  to only include posts that contain the requested tag

- in the updated Post model it includes the Tag model
  under a nested object called 'aspects'

- added tests for updated Post model, updating
  test utils to add more posts_tags relations

- adds two new routes to frontend,
  one for initial tag page,
  another to page that tag page

- for tag pages the array of posts
  is exposed to the view similarly
  to the homepeage

- on the tag view page the information
  for the tag is also accessible
  for further theme usage

- the tag view page supports a hierarchy of
  views, it'll first attempt to use a tag.hbs
  file if it exists, otherwise fall back
  to the default index.hbs file

- modified pageUrl and pagination helper
  to have it be compatible with tag paging

- added unit tests for frontend controller

- added unit tests for handlebar helper modifications

- add functional tests for new tag routes
@fox1t
Copy link

fox1t commented Feb 20, 2014

Nice feature! Looking forward for it!

@ErisDS ErisDS modified the milestones: 0.4.2, 0.5 Mar 10, 2014
@alap
Copy link

alap commented Mar 17, 2014

Adding a few thoughts here.

I know eventually magazine style layout support is expected. When that happens and a tag farm is broken into navigation tags, search tags, nested tags and related tags, I hope it is prudent to put in a tag URL builder of sorts which allows a "site.com/tag/world" become "site.com/world". From a webmaster's structure perspective, if microformat support is to be brought in, then this would be valuable to SEO.

Thank you so much for Ghost. It's rekindled my passion for writing code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants