Blogging, like the wheel, works in its simplest form and rolls despite what it carries.
In this blog post, we are carrying content about blogging and blog posting, ha!
The models:
- Blog Post
- Blog Category
- Author
Sometimes Blog Pillars are thrown into the mix, primarily for SEO reasons and for grouping content topics.
Decisions
Category in post link path or not
yourdomain.com/blog/:post-slug VS yourdomain.com/category/:post-slug
Adding category to your blog post URL has a main advantage of readability, and probably some impact on your SEO, since a topic keyword is right there in the link, however; there are two scenarios where I avoid it
1- Needing to adding multiple category tags on a single blog post which is common, like this post have multiple categories, which category should take priority and stick it self in the link? well, since everything is possible you can add a layer to define a primary vs non primary, or based on index order that the first category is used in the link, but you see how this might complicate things and its not worth it.
2- In a case where a post does not belong to a category for whatever reason blank , this will break the website navigation and result in errors that need to be handled in advance, and will result in inconsistent link structure for your blog, again you might see how complexity might arise here as well.
3- Say you decided to have single category and make it mandatory to avoid the 2 issues suggested above, and you published a post but decided to change the category few months down the line because you added a granular more suitable category, this will end up changing the post URL,
- result in indexing issue and will appear in your search console as an issue that you will need to handle manually
- shared links to this post will break, for example, a bookmark to this particular blog post will no longer work and will result in page not found errors
Note that this 404 redirects also can be handled with a custom redirect functionality, but the question remains, is it worth the complexity?
It becomes evident now that you might want to avoid adding categories in the post URL, which I’ve done in a previous version of this website blog, and advice against it, just drop categories from the post URL and add a dedicated path for categories, let each collection have its own space and room for modifications
SEO for Categories or not
If you settled on omitting categories from the URL, you may still give them some attention and worth, by adding a dedicated path for categories, that will be picked up and indexed for your SEO
This means your category data can and should now have some SEO associated to them, in a similar approach to post SEO but without the post body, and by navigating to a specific category page, a list of all posts associated will be displayed, this works well even if you have multiple categories for posts, or if you suddenly change a post category and will not cause issues if a post have no categories at all, in addition to expanding your sitemap which will broaden you SEO.
Nested vs. Flat Categories
When more publications are added and the range of topics expands, or narrows down, you may want to consider nested categories or sub-categories, this can be done by adjusting the categories data structure.
A common way is to add a relation to self via category.parent
and category.children
concept, where the top level categories will have a blank parent but may or may not have children categories, this off course will require some adjustment in the website and the navigation system to accommodate for the scenarios:
- Parent A
- Child A
- Child B
- Parent B
- Parent C
- Child C
Careful though, this can result in errors if you nest deeper when your website is not ready for it, like having a child of a child, it sounds wrong la! so make sure you think about these points to set your website up for success.
H1 Titles in the post body vs. in the post metadata
A common decision one has to make for blogging, is that, whether to add the post title in the post body, or to programmatically always add it on the web page, this is to ensure every page on your website includes not less and no more that a single H1 tag, if you want to be explicit, including the title in the body is the way to go, this allows you to alter the heading from the meta title of the page.
Author vs Authors vs. None
Having a list of author(s) maybe more common in corporate blogs that personal ones, where the later may skip to none, since all the posts are authored by the same person.
In recent years it is more often that I see blog posts that feature multiple authors, this means there are steps to account for in both the data model and the website.
In the CMS/Data Model, we need to add Author(s) to the post, which can be a list to select from, or a whole standalone model authors that has a relationship to posts
You may want to also add a path in your website to authors, where some info is displayed and all their posts are listed, and lets not forget SEO.
Similar to the single vs multiple categories, Authors as a separate collection will grant you some freedom in managing the data structure and linking.
Regarding URLs, you may want to add a path like yourdomain.com/authors/:author to your sitemap, and maybe add a little bio and an image for each author.
Dates
- Published At: Official date shown on the website
- Planned At: Internal operational deadline simulating a task
- Created At: Private at the database layer
- Modified At: Public or Private at the database layer
Unless you publish many posts daily, you can skip the time, and just include the date.
Other Considerations
There maybe more decisions to make early on to have a smooth rolling blog, like blog cover media, translations and i18n, the nature of the content like text, html or markdown, etc..
I will expand on these here or in a future post... maybe I will talk about my experience with rich text editors and why I settled with CKEditor in my personal projects, while also waiting the right time to explore Nuxt Content , another might be automating Post Cover Pictures and SEO OG Media using Figma Resizer, or Canva which I explored both, and another approach like bannerbear which I heard about from Max @ n8n and is definitely an interesting solution with automation.
Schema / Data models
A blog post schema is a set of guidelines or rules that define the structure and content of a blog post. It specifies the different sections of the post, such as the title, introduction, body, and conclusion, and provides guidance on how to write and format each of these sections. A well-defined blog post schema can help bloggers create more engaging and effective content that meets the needs of their audience and improves their search engine rankings.
Content Model For a Blog with SEO
Schema for Blog Post
Name | Data Type | Description |
---|---|---|
id | Integer | Unique identifier for the blog post |
title | String | Title of the blog post |
slug | uid | A slug is a part of a URL that identifies a particular page on a website in a human-readable format. It typically consists of words or phrases separated by hyphens, and is used to improve the SEO (search engine optimization) of a website by providing context to search engines. |
content | Text | Body of the blog post |
author_id | Integer | Foreign key referencing the author of the blog post |
category_id | Integer | Foreign key referencing the category of the blog post |
created_at | Timestamp | Date and time the blog post was created |
updated_at | Timestamp | Date and time the blog post was last updated |
Schema for Blog Category
Name | Data Type | Description |
---|---|---|
id | Integer | Unique identifier for the category |
slug | uid | A slug is a part of a URL that identifies a particular page on a website in a human-readable format. It typically consists of words or phrases separated by hyphens, and is used to improve the SEO (search engine optimization) of a website by providing context to search engines. |
created_at | Timestamp | Date and time the category was created |
updated_at | Timestamp | Date and time the category was last updated |
To be cont...