Does Stack Overflow use tags on questions as keywords for SEO purposes and how are tags stored in the database?
1 Answer
What tags are and how do they work
Tags exist to connect experts to questions and not for SEO (they are used to an extent for the latter, though). This includes:
- Expedited duplicate closure. Users with gold tag badge in the respective tag can single-handedly (with some restrictions) close questions as duplicates, as well as edit in multiple duplicate targets into the list displayed on already closed posts.
- Following and ignoring. Users can add tags to respective lists to ensure questions from the tags they are interested in are shown, and those they aren't — hidden.
- Review filtering. Many review queues can be filtered by tags to allow reviewers to focus on posts where they have subject matter expertise.
- Searching. Search query can contain any number (up to the query length limit, of course) of tags via
[tagname]
syntax, narrowing the subsequent search results. - Usage guidance. Every tag has (if it is written, that is) an excerpt and a wiki, describing what the tag is about, how and when to use it, and in many cases examples, resources, and even lists of prominent Q&A pairs.
How are they stored in the database
Information about tags is stored in 3 tables: the Posts
table (in the Tags
field, which is an nvarchar(250)
field formatted as a list of tag names enclosed in <>
), the PostTags
table (the relationship between tags and posts), and the Tags
table (the information about each tag).
Stack Exchange database schema is publicly available if you need more info. There is also an open source explorer (SEDE) where you can make queries against the database.
-
@rene yeah, forgot to specify those (was too focused on the OP's context)! I'll take your word for them being derived from the
Tags
andPostTags
- from the schema, I surmised thePosts.Tags
field was not connected to those tables and updated separately, though? May 10 at 16:30 -
@rene ah, sorry, I think I know the problem - it wasn't my intention to specify the
Posts.Tags
the column as the source of truth with others being derived from it, but I can see how my wording is messy in that regards. I'll try to clarify May 10 at 16:36
nvarchar (250)
type field.<title>
of the page. So, for example, the question SQL Count each occurence of words separated by comma has "sql server - SQL Count each occurence of words separated by comma - Stack Overflow" as it's<title>
, as [sql-server] is the most popular tag that isn't already in the title ([sql] is the most popular, but is already in the title).