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.

Support

Automatic URL manipulation via header.routes.default

Solved by Bernd Herbig View solution

Started by Bernd Herbig 8 years ago · 1 replies · 559 views
8 years ago

Hello together,
I would like to remove the /folder/ part from the url. (The parent folder)
I wrote
header.routes.default:
type: text
autofocus: true
style: vertical
label: Meine URL
default: "/"
into the system/blueprints/pages/default.yaml and it works fine.

Now, I would like to create or save the page and the header.routes.default should be written automatically into the default . md and especially it should be written default: "/foldername"

So I wouldn't need a extra field on my content area and it wouldn't be written manualy.

Thank you in advance.
Best regards
dci

8 years ago Solution

Hello,
I believe, I solved my issue by myself.
On the file system/src/Grav/Common/Page/Page.php I expanded the function frontmatter.
$this->frontmatter = (string)$var."routes: \n default: /".preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder);
works fine for me.
Sure, I shouldn't work on /system/src ... but what should I do?
I think it would be more comfortable, if I could set it folder by folder (functionality like home-folder) via true or false on the admin panel.
dci

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago