WordPress.org

Ready to get started?Download WordPress

Forums

get_the_category or type out category for article title? (2 posts)

  1. ggg377
    Member
    Posted 1 year ago #

    Hi. My page handles specific media in a very limited set of categories. Every post will have a visible category assigned to it. The categories also serve as search keywords for my site.

    Example of posts:

    Video: Some artist - Title
    Music: Some artist - Title

    etc

    My question is, in WordPress, would it be better to have the title as such:

    <h2><?php get_the_category(); ?>: <?php the_title(); ?></h2>

    or as such?

    <h2><?php the_title(); ?></h2> (with the category typed out in front of the title, for example Video: title)

    My concern is that if I include the category before the title with the function, the category won't get included in the title part of the permalink and I may lose search engine rankings because of that, especially considering these categories are usually the keywords to my site. However, my current permalink structure looks like this %category%/%postname%. If the category still gets mentioned within the permalink, just in the %category% section, would it be as good or would it be inferior to having it mentioned in the %postname% keyword wise? I'm thinking it's possible bots don't even separate the permalink like that and see it as a whole, but I could be wrong. Can someone please clarify this?

    Also from what I'm getting, as long as the category function is within the title (H2) tags, it won't be any different from typing it out, because the search engine bot won't be able to see the actual code, just the output html, which will look exactly the same? Once again, I may be wrong here so I need some insight to this.

    Currently it seems to me that it would be wiser to use the function over typing out the category, however I need your opinions to be safe on this issue.

    I would be thankful if someone could answer my questions.

  2. flashrebel
    Member
    Posted 1 year ago #

    I think always is good, if website have simply structure - if article(title) is inside category, that is good if link is category/title.
    Good for users, good for website structure and good for search engines

Topic Closed

This topic has been closed to new replies.

About this Topic