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

Theme API: Determine single vs multi-author blogs. #4908

Closed
issmirnov opened this issue Feb 11, 2015 · 7 comments
Closed

Theme API: Determine single vs multi-author blogs. #4908

issmirnov opened this issue Feb 11, 2015 · 7 comments

Comments

@issmirnov
Copy link

As per the comment below, I am editing this issue to have the problem foremost, and then potential solutions

Problem 1 - There is no way to determine if a blog is single or multi author, which can cause minimalist themes to have undue clutter

The way Ghost's defaults are set right now, the author object is a child of the post, and as such, on a single author blog the author's name can become an eye sore.

Example 1

As can be seen here, my home page has my name appear in the url, the main blog title, and every single post. I know for some people this is important, but for my personal needs I would prefer a way to only have my name appear a few times on a page.

home-page

Example 2

This problem is most obvious on the /author/author-name endpoint. We are on an author page, as such, it's obvious that all of the posts listed here will be by the author. However, the author's name is still multiplying in our eyes:

author-page

Proposed Solution 1

Add a @blog.author.multiple and @blog.author.single tag, set according to the number of registered authors. This tag can be used in if/else clauses to modify the theme as needed.

Use Case 1

I think it would help a lot if theme designers had a way of figuring out whether a blog is single user or multi user, and adjusting the theme accordingly. For the minimalist themes that I (and many others) use, the cleaner the page the better. Once there is a way to determine the nature of the blog, theme designers can add a conditional to their pages to exclude author links as desired.

Proposed Solution 2

As seen in example 2 above, the author page uses the same post loop partial as the main index. For a single user blog, the "by Author" suffix would not be present on any post links, so the problem is solved. However, on multi-author sites, the post loop on the front page should have an author link, while the author page should not.

Options:

  • create a second partial/loop.hbs post file, which will not include the author.
  • on the author page, set some variable that will allow the theme designer to disable the author link in the post loop list when displayed on the author page

Further Thoughts

Depending on where the maintainers of this project want to take it, it might be useful to expand the @blog.author data resource to allow iterating over various authors, getting a total count of them, and having their author links accessible from a global name space, rather than from within a post. This will allow the creation of an "About Us" page that can display all of the authors of the site, with their bio's, locations, etc.

What do you all think?

@ErisDS
Copy link
Member

ErisDS commented Feb 12, 2015

Hey there @issmirnov, welcome! I have only skim read what you've written, but it sounds like you have an interesting proposition and I wanted to give you some quick feedback right away that will help to move this sort of feature request forward.

One thing we're really big on, is ensuring that we clearly and fully understand a problem before designing the best possible solution that solves as many use cases as possible, and fits into the theme API. In this case, you've got a solution first - so I would recommend reworking this a bit to put the problem first, describing the use cases and all the wonderful things themes would be able to do if it was possible to determine whether a blog was single or multi-author.

Then provide your potential solution at the end. That way, you open up discussion of the problem and use cases you may not have thought of, promote the design of the best possible solution and with all that the issue title ought to stay relevant.

@issmirnov
Copy link
Author

Hey @ErisDS, thanks for the welcome! I've updated my initial post with some screenshots and more structure. Take a look when you get a chance - I hope this edit will be closer to what you are looking for. I think there's definitely a lot of potential, both for theme designers and expanding Ghost's API in general.

@ErisDS ErisDS changed the title Expand @blog to have @blog.author, for better themes Theme API: Determine single vs multi-author blogs. Feb 13, 2015
@igregson
Copy link

A related problem that I'm currently facing: needing access to authors (and tags, but that's another issue) in the global data scope. This seems so basic that I had even assumed it was currently possible (it's not, right? at least it's not documented where it seems most logical).

Use case: a single-page-ish theme that uses ajax to display posts into a div with another div used to list posts that can be filtered by tag and author. Think: content section of the ghost admin area but as a theme, with different styling, and filtering. Of course there are hacks to get around this (javascript logic with hidden divs and such) but having a clean way to do it through the api would be incredible.

Just a few cents from a Ghost theme dev. By the way, Ghost team and contributors, keep up the great work :)

@igregson
Copy link

Also, regarding the API implementation, a simple {{@blog.authors}} with an auto-link boolean seems simple yet powerful enough (at least as a starting point). In theme-side javascript logic this could then be queried for length to determine single vs multi-author blogs.

@ErisDS
Copy link
Member

ErisDS commented Feb 16, 2015

Hey @Isaaki you are correct that there is no access to tags or authors in the global context. Ghost, by default, does the queries to fetch the exact data needed to render a particular context (a single post, a list of posts etc). Making all data always available just doesn't make sense.

Therefore the future plan is to provide access to the API to allow theme authors to get any additional data they might want to display. You can read about those plans here: #4439

Back to the original issue of determining if the current blog is a a single author blog, the @blog global is an object which contains a few global blog settings, so this does potentially make sense for providing a flag.

If it was decided this was desirable, then I'd propose keeping this to a simple flag @blog.single_author, which returns true if all of the published posts belong to a single user. This would allow for doing either {{#if @blog.single_author}}, or {{#unless @blog.single_author}} for the opposite case.

However, at present, I'm not sure if the demand for this is enough to warrant providing an additional flag above and beyond what will eventually be possible by making a request to the API. I certainly think it's interesting, but as it's my job to consider things from all angles, I'm also wondering if there is any merit to having themes be clearly aimed at either single or multi-author blogs that would be lost by adding something like this.

@issmirnov
Copy link
Author

@ErisDS - what's the time table on the Ghost API? I haven't dived deep into the ghost engine yet, but if you direct me I would be happy to help with either getting that started and exporting an /authors endpoint that could be referenced with {{#get "authors" limit="all" }} to get the length, or temporally put in a @blog.single_author tag until the official API release.

On a side note, do your stats tools allow you to get a distribution of single vs multi author blogs? I don't know the privacy implications, but perhaps if you could find a specific percentage for the two categories it might be easier to see how helpful (or not) this change would be.

@ErisDS
Copy link
Member

ErisDS commented Feb 17, 2015

Hi @issmirnov,

I raised this proposal in today's public dev meeting to get some feedback. There was a discussion (which you can read here), and the overwhelming consensus is that firstly there's not enough demand for a solution to this problem, and secondly that this isn't the right way to resolve it.

In the near future the addition of the get helper will provide an alternative means to inspect information about authors within the theme rather than providing a specific flag. I've added a status update to #4439 which explains the status of the {{#get}} helper. As we already have an issue open for tracking that addition, I'm going to close this one.

@ErisDS ErisDS closed this as completed Feb 17, 2015
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

No branches or pull requests

3 participants