Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Business SEO Basics Better SEO Through Code Title Tag

Jenny Swift
Jenny Swift
21,999 Points

Title Tags for SEO in Single Page App

Hi, throughout this course it's assumed that there are many pages and therefore many title tags, whereas I have built an SPA and so I have many 'pages' but only one title tag, which feels limited for including keywords in the title. Suggestions please? I think it would be advantageous to have many title tags so I don't have to try to describe every page in just one title tag, but I'd like to keep it as an SPA because it makes the pages faster to load.

Jenny Swift
Jenny Swift
21,999 Points

Dan Gorgone, what are your thoughts on this, please? And thanks for the course!

Mark Miller
Mark Miller
45,831 Points

I ran into a Ruby course that goes into the subject matter to answer this, "variable title" question for potentially existing content. It seems the SEO value could be higher for sites that have infinite potential to generate content, but I'm not sure about that. I think SEO value is probably only determined by existing content, not potential for any content. Certainly there are problems with potential content, such as rating. I think you can have a limited list of existing titles, all of which are available for SEO value, because those are separate pages existing on demand.

https://teamtreehouse.com/library/url-parameters

2 Answers

David Bath
David Bath
25,940 Points

I've been grappling with that same issue since taking the SEO Basics course. The conclusion I came up with is that it's best to just include the most important "summary" keywords in the title, and then elaborate in the description meta tag.

I'd like to throw out another idea that I haven't tested, but intrigues me. What if the page title was a variable determined by the page controller? Let's say it's an AngularJS site, and the ng-app directive is on the html element. Could you have a variable called pageTitle or whatever that you set in each page's controller, and then print out in the title tag:

<title>{{pageTitle}}</title>

I assume this would work on a technical level, but would it work for SEO purposes? Would Google pull the dynamically generated text, or would each page have a title of {{pageTitle}} as far as Google is concerned?

Jenny Swift
Jenny Swift
21,999 Points

Hi David and thanks for responding. :) I was wondering about that variable idea for the title tag too, and likewise wasn't sure how Google would handle it.

Mark Miller
Mark Miller
45,831 Points

The entire purpose of using content management systems, instead of hard-coded HTML, is supposed to be the advantage in generating page-specific content on demand. In other words, the variable title tag is exactly right to answer this question. On search, it seems that the search engine would ideally flip through all the potential titles for each page in a site, but that can only happen for existing content. The variable title tag is the answer to Jenny's question, I think. I don't know what an SPA is.