Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Create a sub-article in WordPress from an existing article?

         

Lucas_Lopez

8:18 am on Apr 4, 2023 (gmt 0)



Hello Friends of coding and programmation,

I am new to WordPress and I am looking to create a “sub-article” from an existing article!?

Specifically:
For my site, I have a “Culture “category and an article “420” with the following URL:

https://example.com/culture/420/

What I would like to do is to easily add a sub-article (page?) as it is possible with pages and the “parent” option. For example, a sub-article about France:

https://example.com/culture/420/france/

However, with articles, this option is not available, only adding subcategories is possible, and that’s not what I want for several reasons:

– By creating a subcategory, I “lose” my /420/ article because it automatically becomes a listing category page.
– I don’t want to create a category for each subpage; that would be too many.
– It quickly becomes chaotic with subcategories, creating duplicate content.

For now, to illustrate my problem, I have left my blog with a subcategory, but now my article 420 no longer appears.
In the WordPress display, with two “equal” URLs, I imagine that the category takes precedence over the article, and since the article and category have the same URL, WordPress must make a choice!

What would be the solution to implement?

Thank you in advance for your help and kindness.




[edited by: not2easy at 11:33 am (utc) on Apr 4, 2023]
[edit reason] Please use example.com for domains [/edit]

not2easy

12:00 pm on Apr 4, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi Lucas and welcome to WebmasterWorld [webmasterworld.com]

I should explain that for readability we use 'example' com so that others can see the URL under discussion. We want to discuss your question, not your domain. ;)

You can assign posts to categories, that is generally how you add separate articles to a category. As you have noticed, WP uses a hierarchy to help people find additional related topics in a category and you can assign one or more parents to a post.. WP will display things in a variety of ways so to avoid the duplicate content issue, you should assign a canonical link for each new page whether it is a category or a post.

Google understands how WP works so they expect you to offer up a sitemap of posts and pages and for those to have a preferred canonical URL assigned. Be careful of what you try to submit as sitemaps because only one version of an URL will be selected. This means that Google does not index every possible URL related to the content, you should use canonical meta tags to outline the structure.

In our WordPress forum Charter: [webmasterworld.com...] you can find resources to help you learn more about how to best use WP, they offer free tutorials for specific topics at https://learn.wordpress.org/

serserg

12:21 pm on Apr 4, 2023 (gmt 0)



The way out. If there are few such pages, you can create them as static pages in Wordpress and just link them in the "parent" records.

Lucas_Lopez

2:25 pm on Apr 4, 2023 (gmt 0)



Thank youNot2easy & Serserg both for your answer :

I just tried with the plugins:
Posts 2 Posts
custom post type ui
(plugin to customize posts)

Post Tags and Categories for Pages
Pages with category and tag
(plugin to add categories to pages)

So finally I tried an extension that customizes permalinks: Permalink Manager
And it work as i wanted!
But...

Except that now my urls are no longer translated by my TranslattePress plugin...
and therefore for example the part (category) /culture/ of my site is not translated into /cultura/ for the Spanish part...
(for 420 there is nothing to translate lol)

ex I got:
https://example.com /es/culture/420/francia/

instead of what I want:
https://example.com/ es/cultura/420/francia/

the 'a' makes all the difference and it is valid for the other languages...

I wanted to go back to rewriting in Htaccess but it's beyond my knowledge and it's just a gas machine!
I imagine there must be a conflict between the Permalink extension and TranslattePress
What a disappointment so close to the goal!

If you have another method I'm a taker but as you said before is better to don't custom too much!