Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

How to? Blog URL = domain/blog/ & Item URL = domain/item

Started by Tim 7 years ago · 2 replies · 580 views
7 years ago

Hello, everybody,

I'm sure there are several ways to achieve what I want. So I want to know which way you think is the best.

What I want:

I created a blog in domain/blog This should be an overview of sites and articles I write.
The Item URL should not have "blog" in its URL. It should be like domain/item-url

My solution so far:

  1. I create the content under domain/item-url
  2. I create a dummy blog item under domain/blog/item-url
  3. I create a Route Overrides - Default Route to domain/item-url

Is there another solution where I can do it without the dummy article?

  • Moving the blog to /root aka make it /home is not an option, because /home is a modular landing page.
7 years ago

I already tried this:

TXT
routes:   /blog/(.*): '/$1'

It does not work. The links in the blog overview are still /blog/item-url
If I click them I get

TXT
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 262144 bytes) in /grav/system/src/Grav/Common/Page/Pages.php on line 536 

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 262144 bytes) in /grav/vendor/filp/whoops/src/Whoops/Run.php on line 375

More Info:

The Folderstructure looks like this:

  • /blog/
  • /blog/item1-url
  • /blog/item2-url

In the end the links should look like this:

  • /blog/ (overview)
  • /item1-url (URL to article in folder /blog/item1-url)
  • /item2-url (URL to article in folder /blog/item2-url)
last edited 05/24/19 by Tim

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 76 8 hours ago
General · by pamtbaau, 13 hours ago
1 47 12 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago