Use taxonomy in permalinks?

I’ve been doing some research about permalinks and SEO, and from the wordpress world, it sounds like they recommend permalinks where it’s the domain followed by the name of the post in 3-5 words with no “stop words” like if, or, and, is etc. They also say it’s good or ok to put a category subdirectory between the domain and the post title. Here’s where there is a conflict with Hugo’s paradigm as I see it:

Section is a way to collect posts of the same type, and it’s how to make the powerful archetype feature functional. When you make a new content file in a specific section directory, the corresponding archetype template will be used to prepopulate the content and frontmatter. This can’t be done any other way, as far as I know (other than copy pasting). The section of a post also tells Hugo which layout to use as a template for building the page. So typically the sections should be named or categorized with respect to the type of content it is… so that the layouts are efficiently reused. You could have a section for a blog post, newsletter, news article, review, essay, tutorial, whatever. Each of those types would have unique front matter in a corresponding archetype and also layout template… but it doesn’t say anything about the categorization of the content within. That’s where taxonomies can come in.

You can, in the front matter, tell Hugo that this post is of type and layout such-and-such regardless of its location in a certain section. But this I suspect is more of a one-off… at least, I can’t see the use-case for it on a regular basis.

So then if you take the traditional taxonomies, categories and tags (they could of course be anything at all, those are arbitrary names), you would typically have a content file in a single category but it could have multiple tags. So then, wouldn’t it be better if the website folder structure was ordered with respect to the category instead of the section? Seems like it would be something that could be done with a permalink but :category is not an option (or taxonomy name is not an option). That way you can have all your posts about Hugo, whether it’s an article, blog, review, or tutorial, originate from domain.com/hugo/content/ instead of something like… domain.com/review/content.

Is there a way to do this? Am I thinking about it all wrong? I know with :slug in the front matter, you can customize it per file, but that’s it.

Please ignore the “wordpress world”. If you want to know about SEO, follow SEO blogs from search engines; it is their thing. And here is a pro tip: write authentically with an eye towards how folks search for content, and your site will do fine.

As for the functionality in Hugo, how would one decide which taxonomy term goes into the slug? The first one in the array? That is a lot of technical expense for something that doesn’t affect SEO at all. :slight_smile:

1 Like

Well, the category in the permalink thing isn’t really for SEO. It’s for context. As I said, I’d rather not have the subdirectories in the link be based on type but on context and content. So a tutorial for linux wouldn’t go under /tutorial/ but under /linux/ along with blogs about linux and whatever else.

Or, is the answer to make the sections the contextual categories I want, and then use the type/layout params to tell Hugo which layouts to use? A little more work but it’s supported now. I’m just wondering how to structure my site now before I really get in deep with it.

I agree, I’m just trying to digest all the things people have written about online. And mainly I’d like to make the website and structure make sense to me and visitors.

You don’t need to configure permalinks to get a URL like /categories, but I think you are confusing the purpose of taxonomies in Hugo.

In Hugo, taxonomies essentially allow for convenient list generation to demonstrate relationships between instance of content types (I mean content types here in the content management sense and nothing MIME, etc related). In a way, you can think of the taxonomies as something similar to facets in a breadcrumb search (like Amazon). In this way, Hugo uses the term taxonomies in a very specific sense.

If you want a URL similar to what you put above, why not just name your sections accordingly (i.e., give them a category name)? I think you’re confusing site architecture with informations architecture. Site sections are an example of the former and taxonomies the latter…

:+1: There are innumerable blog posts on how “Wordpress is better for SEO”…and they’re all written in Wordpress.

You can access content section via page variable, but that doesn’t mean its content. By default, sections are already context in Hugo. That’s why they map directly to a URL by default.

Keep in mind that Hugo makes no assumptions about how you construct your content model/types (e.g., with site archetypes), so your example with Linux is a good one in that you may have several different types of content associated with the category. Now, /categories/linux will show all the related content for your end user, which is great, especially as your site starts to grow.

I think one element that may mislead you if you’re looking into WP-centric SEO blogs is that WP has a very restrictive data/content model where everything is ultimately a page or a post. Hugo doesn’t restrict you in this same way. If you start thinking about more than just posts–i.e., really complex content models for large sites–you start to see the utility of Hugo’s taxonomies. The challenge then becomes figuring out to leverage taxonomies as a controlled vocabulary rather than folksonomy…

I know there is no love for wordpress here, even though it’s the same general goal as hugo. But surely they have something to say about SEO, Yoast, the popular SEO plugin, has great content on their website which is very generally applicable to blogging and websites, and many of the same techniques used in wordpress are just as applicable elsewhere.

I suddenly feel transported to 1601 England.

I freely admit as a newcomer to blogs and Hugo, it’s a bit difficult to wrap my mind around content and information organization. Figuring out how to leverage taxonomies is the $64,000 question. And what I’m trying to do is make a website that makes sense to me in my content creation process and on my local drive organizationally, and also makes sense from a user perspective as far as finding content they are looking for.

My main goal, is to understand the best way (or a really good way) to structure my content and structure my information locally and as a website, so I can start my blog on a solid foundation that will scale and allow for flexibility. As a newcomer, I have a difficult time finding or thinking about the right paradigm for what I want to do.

Maybe I don’t mind having my sections be the TYPE of posts, so that it will integrate well with archetypes and template layouts, and just worry about the informational context using taxonomies.

Help me Obi-Ryan Kenobi, you’re my only hope.

If you want a blog, luckily that’s the easiest content model around. If you tell me what you want to write about, I’ll gladly help you set up your sections.

As for the idea of having the article live in a taxonomy in terms of URL, think about this: you’d have two URLs for the same single content page, which would be terrible for your SEO.

P.S. Yoast is a great tool. The real issue is that the CMS used doesn’t matter to Google. And FWIW, some Wordpress sites–and very big, popular ones–do very well using categories and tags for taxonomy pages while allowing permalinks to use different sections. Wired.com, which is Condé Nast, springs to mind😉

I’ll am going to be quoting around, but hopefully it will make sense. :slight_smile:

I personally love WordPress! Even when I build Hugo sites, I use WordPress for data and media management. I also host sites that get half a million unique visitors a month, and WordPress doesn’t break a sweat. It is great software!

When I said “please ignore” it, it was because I suspected you were reading Yoast’s site, because that is the most popular SEO plugin. My advice stands, SEO knowledge comes from search engines, which basically means Google, and everyone else is commenting on it. Yoast’s business is to sell plugins, so there is a strong marketing drive behind their advice, which itself leads to diminishing returns.

WordPress, out of the box, has terrific SEO. If you want to get a baseline to build from, check out Search Engine Optimization for WordPress.

That is cool, but keep in mind you should focus on your visitors. You are a weird person that builds websites in text files. You aren’t a normal web user anymore.

The good news is, you can watch what other people do, and also just pay attention to how you actually use websites, when you are not being critical of them.

For instance, view-source happens at least once for every site I’ve ever visited, and I will look at URL patterns and edit them to go to other parts of a site, or just to see what happens. Most folks are not doing that.

While I do enjoy a good human-readable URL, if your title is populating with unique titles for each page on your site, folks will be able to use it, find it in search engines, and get back to a page they visited before.

Here is some straightforward advice:

  • Put “static”/evergreen content in a pages content directory, and set URL pattern for the section to be “/:slug”. Override as needed on individual pages. These are for things like “about” or “contact” pages.
  • Put all your chronological pages in posts. Set the URL pattern to be something useful, definitely including the title. The pattern for my site is posts = "/:year/:month/:slug/". I like show folks a general date of when it was published, but don’t need a day included. I prefer this pattern for myself, when visiting other sites.
  • If you use a category taxonomy, use it for interests your visitors will be interested in, so they can find all of the content easily. I personally like subscribing to the RSS feed of a category when I may not be interested in all the other content on a site.
  • Use a tags taxonomy to piece desperate content together. I pick major themes in my posts, as well as all proper nouns. If a tag ends up being used as often as a category, make it a category (in Hugo that means editing a bunch of posts, but it will be caught early and will greatly benefit your site).
  • Use sections from the perspective of a site visitor, discerning the kind of content it is. If you have pages, posts and docs, of instance, those will have templates that different according to being useful to readers. But before you add a tutorial section, think if that makes sense as one of the other sections. If it is time sensitive, a blog post tutorial is appropriate, whereas frequently updated tutorials that stay current belong in docs.
  • Also for sections: keep it simple. You aren’t help anyone by complicating it, and the most likely scenario is that folks visit your site from a search engine and bounce. That means the most impact will be on those single pieces of content.
  • Ignore content types. You, specifically, don’t need them. There are content models that certainly benefit from types, but I don’t think it will help you, and just gives you another facet to consider, leading to difficulty structuring your site. But don’t worry, when you are ready, they will be there, and it will make your foundation better.
  • Avoid additional taxonomies for now. If you want to experiment with one, just make them tags for now. You will produce content faster, and see how folks actually use your sites. Maybe you tag people a lot, and want to create a people taxonomy, but checking your analytics you notice no one ever lands on that tag page, nor do they click the link from posts… boosh, you know you are doing okay.

Without content your site has 0% SEO. The most important step you can take is to start publishing, and if your template is marked up reasonably (and I haven’t seen any Hugo theme that sucks; I would have said something), you will be doing great. That is your good foundation.

And as you learn about how your site is used, you will know how to tweak SEO, and it will be an enhancement. You won’t figure it out until you see how it is being used. :slight_smile:

I am not sure this is a thread to discuss this, but if you want to break out and discuss the differences between WordPress and Hugo in this way @rdwatters, I am game! My hot take is the opposite of what you said, but I may not be catching what you are laying down. :slight_smile:

1 Like

Well, in part a blog, but also teaching stuff and some review stuff, maybe some news related content. A smattering. Tech related but some general topic stuff, philosophy and family stuff. I’m warming up to the idea of making my sections relative to the type of content and not the taxonomy of the content. As I said before, this simplifies many things in Hugo as the archetypes and layouts are in part designed to take advantage of the section as a discriminator.

Permalinks

You mentioned permalinks, but is that different than canonical links? What is the real purpose of permalinks if not to use as a config param to change the url of entire sections?

Canonical links would be the “official link” to be used by search engines. Seems like turning on canonifyurls in config would be good no matter what… ? But turning on permalinks depends on what kind of look you are going for in a url structure?

The link below talks about content structuring with assests and how permalinks affect (negatively) the rending of assets in the same folder as the content.

I really like the idea of bundling assets and content together, for a bunch of reasons, some of which I laid out in that post. But i’m wondering if I care about permalinks? Honestly the only reason (at this point) I can think of using permalinks is to make it so the url is not preceded by the section name, so it’s just domain.com/post-name/ which places like Yoast seem to prefer and employ. (i know I’m picking at nits about that from an SEO perspective, I definitely get that). But other than that, I don’t see the value of the permalink config parameter. On the other hand, a markdown preview of the graphics is nice but it wouldn’t work if I used shortcodes anyway, and… I can live without it given the live-refresh of the server.

That was an excellent reply! Thank you for the great advice, practicalities, and encouragement!

I do have one comment regarding:

I am reminded of this (read through the tweet replies):


and this:

I was originally with you on the dates in the URLs as I am an analytical mind, but it seems pretty clear that they are universally not recommended in the URL.

Switching directions to the local side, how do you structure your hugo content and static directories? Do you put your posts and their related assets (images etc) together in content? do you split them between content and static, do you mirror a directory structure in both? Do you have all your content files in a single folder? Trying to find a technique for managing local content is also something I’m trying to figure out, it also determines whether or not I use permalinks because currently, if you bundle your content and related assets together, and use permalinks, they will break the rendering of the assets (because the assets are not relocated to the permalink structure).

Wordpress SEO says to use permalinks mainly because that way you don’t get the hideous dynamic database pull link of /?=2328 or whatever. That’s not an issue in Hugo, so other than restructuring the URL for cosmetic/SEO purposes, and those would be minimal benefits, doesn’t seem like permalinks are really needed. Maybe they are a tool for people converting to Hugo?

Your bias is that you think your content is the most relevant. I would be so happy for that to be true in my case, but if I wrote about something four years ago, but other folks have more recent posts, they should “win”. If the thing I wrote was valuable, it will still raise to the top.

The immediate concern is that folks can regurgitate content and get more traffic, but that isn’t a game I am willing to engage in.

I didn’t read the Twitter thread, but understand the analytics are not SEO, it is click-thru. Definitely related, but a useless metric on its own.

Analytics for a site are useless without context. For me, I like to share knowledge and convert visitors into clients. For clients, I want to convert visitors into customers or donations or something. I’ve increased traffic 400% during a migration, but it didn’t increase sales until we started writing good content and listened to visitor feedback.

So just keep in mind what game you are playing. You can do all kinds of stuff to win popularity, but popularity doesn’t pay the bills for me, hence the “diminishing returns” I mentioned.

I presume you mean you link to assets relative to the content. Don’t do that. Use a shortcode, and keeps assets elsewhere.

I don’t even keep mine in version control, I actually built a WordPress site that optimizes my media and serves it from a CDN, and built a theme to output the shortcode I use in content, so it always references the correct, external media file.

I do that because the sites I build use a lot of media, so if I tried to move a site to Hugo, or keep on eye on growth, it doesn’t make sense to complicate my deployment with a bunch of assets. I’d need to involve more caching and deal with Git LFS or something, because the smallest site I host right now has 300MB of media, but the average media library is 3.5GB (that is before multiple versions of the media, too).

But if I reused images, and didn’t need a lot of storage, I’d put everything in static. I like reusing media, and don’t consider a piece of content an object to be bundled, like many developers using static site generators. There are use cases where it makes sense, but I would never start a project and bundle media next to the source content files. :slight_smile:

very good points, thank you!

Gonna try to say this in a different way: SEO, as well as actual best practices on the web, have nothing to do with Hugo or WordPress.

A permalink or permanent link is a URL that is intended to remain unchanged for many years into the future, yielding a hyperlink that is less susceptible to link rot.

The developers behind WordPress and Hugo look at best practices, and implement them as sensibly as possible given the underlying technology.

WordPress has a database and needs a method to identify each piece of data, and permalinks make that easier on humans to query the database. Hugo’s structure is based on a filesystem, with configurable options to produce a different filesystem (produced in public).

So comparing what WordPress does to Hugo isn’t useful, in my opinion. Looking at a best practice and asking how to accomplish it in your tool of choice the the path forward, um, Princess Leia. :slight_smile:

1 Like

I’m going to be a buzzkill for everyone involved in this thread, but I feel like we are getting into some black magic SEO here. Google has said since 2014 that the most important thing you should focus on w/r/t SEO is creating high-quality, well-structured, sharable,relevant (often that means niche) content to promote link juice and establish yourself as a credible source.

Set up (dev) is still very important, but if you’re writing a blog and you want it to gain some prized top-SERP real estate, the biggest chunk of your energy should be focused on writing. Other than that, there are hundreds of metrics Google uses to rank your pages, and many of them are completely opaque to the outside world :smile:

1 Like

Totally correct. Also, I read the google web developers info and it reflect this. Also, plenty of people, Pat Flynn and others, say the best things for SEO are high quality, high value, and good experience. (which is why i’m using Hugo over Wordpress, for the staticy speed).

What I’m more focusing on now is what kind of local structure should I start out with so it is sustainable, I can replicate it, and it’s flexible and expandable. That’s mostly where I’m getting into the “how do I want my links to look” “how do i want my local folders organized” because that all plays a role in a cluttered or organized site (on the local dev level).

This I cannot agree enough! LOL!