picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.83k stars 617 forks source link

Current URL #409

Closed mmmykhailo closed 6 years ago

mmmykhailo commented 6 years ago

Can I get URL of current page in twig? I need something like $_GET from php.

mmmykhailo commented 6 years ago

{{ page.url }} didn't work for me

PhrozenByte commented 6 years ago

You can get the URL of the current page using {{ current_page.url }}. Please note that this variable is undefined for "virtual page" that are generated by a plugin on-the-fly. However, this variable doesn't include HTTP GET (or URL GET) parameters.

If you rather want to access HTTP GET ($_GET in PHP) or HTTP POST ($_POST in PHP) variables, use Pico's official HTTP params plugin (http://picocms.org/plugins/#entry-http-parameters). Please note that this plugin will be part of Pico's core starting with Pico 2.0 (currently in beta).

mmmykhailo commented 6 years ago

Thank you again