Support for page urls

Now we can access pages with the following url
/p/<project_url>/<page-url>. Internally we use the existing view_node,
but if we detect that the node_id is not an object id we try to treat
it as a page url and therefore we try to define node and project using
render_node_page().
This commit is contained in:
2016-12-02 16:57:48 +01:00
parent bc456f9387
commit 6bb491aadc
2 changed files with 55 additions and 22 deletions

View File

@@ -29,6 +29,18 @@ include ../_scripts
| {% block footer_scripts %}
script.
// Push the correct URL onto the history. This push happens after the id has
// been pushed to the history already. We should probably keep only this and
// skip the project-level displayNode push.
var url = '{{ node.properties.url }}'
var push_state = {nodeId: '{{node._id}}', url: url};
// console.log('Pushing state ', push_state, ' with URL ', push_url);
window.history.pushState(
push_state,
'{{node.properties.url}}',
url
);
// Generate GA pageview
ga('send', 'pageview', location.pathname);
| {% endblock %}