Virtual Page für News-Posts

Hi there,

For my client I made a website with news-articles directly on the homepage. So technically a news-post is a subpage of the homepage.

So the URL of the single-view of a post is:

https://my-website.com/my-news-post

My question is:

Is it possible to have all news-post additionally on a virtual (?) subpage called “news” so that I would have a second complete collection of all news-posts under

https://my-website.com/news

and also the URL of the single-view of a post would be:

https://my-website.com/news/my-news-post

Actual I have no idea how to do this. Can you push me in the right direction? Thanks! :slight_smile:

Hey,

the easiest way would probably be to create a new template for /news where you query all children from home? root? Wherever those news posts are located. So something like:

```php

<?php $news = page(‘home’)→children()→listed(); ?>

```

and maybe filter and list them. You could use this template for a virtual page or a “real” one.

Keep in mind that you need to set canonicals; otherwise, Google and other search engines will detect your news posts as duplicate content.

Thanks for the tipp.

But how can I solve that the single post has the https://my-website.com/news/single-post URL?

Can it be done by routes?

What I wonder is why your children of home are running under https://my-website.com/my-news-post instead of https://my-website.com/home/my-news-post which would be the default.

And why not simply renamel home to news and make this new news page the home page. Having the same page under different urls is not really recommended SEO-wise.

You are right, Sonja, of course the children of home are running under https://my-website.com/home/my-news-post.

Your advice sounds great, I didn’t think it would be that easy, but how can I change the slug of the homepage to “news“ the easiest way?

Ah, okay, I found it in the reference!

thanks a lot.