Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

Serving Pages

Vishal edited this page Apr 29, 2020 · 3 revisions

What is a Page?

In Profile Server, a page is any document with content you want to serve.

How to serve pages?

To create a page, just create a markdown file (Only files with extension md are considered for page creation). The markdown file needs some metadata to be served. These are the necessary metadata and the default value they take.

  • title: The title of the page. Default: filename
  • permalink: The permanent link to the page. Default: relative path from pages_diretory
  • date: Date of publishing. Default: date of access
  • paper_url: Any paper you want to link. Default: null
  • excerpt: Excerpt of your page. Default: null

If you don't want to use your own values for these parameters, add them as metadata at the starting of your markdown file as shown below

---
pagemeta
<your_metadata>
---
<content_goes_here>

Sample Markdown file for page with custom meta data

---
pagemeta
title: Sample Page
collections: publications
permalink: /somepath/somepage
excerpt: This is a link to GitHub
date: 16-03-2018
---
# This is my first heading
This is some content
[Github](https://github.com)

Accessing your page

You can access the pages you create at http://localhost:8080/<permalink>. For the sample page shown, the url would be http://localhost:8080/somepath/somepage

Response

The response to http://localhost:8080/<permalink> will be in the following format:

{
    "is_page": true,
    "children": [],
    "page": {
        "permalink": "<permalink>",
        "title": "<page_title>",
        "date": "<date>",
        "paper_url": "<paper_url>",
        "content_md": "<content_of_page_in_markdown>",
        "content_html": "<content_of_page_in_html>",
        "excerpt": "<excerpt>",
        "collections": null,
        "page_venue": null
    }
}

Finding out where a path leads

Hitting any valid URL which is not a page, but a part of the permalink to the page will show all the next steps available in the path.

Consider the example shown above. The permalink for that page was /somepath/somepage. Now, hitting the url http://localhost:8080/somepath will show all the next steps available for that path.

The response for http://localhost:8080/somepath will be

{
    "is_page": false,
    "children": [
        "somepath/somepage"
    ],
    "page": null
}

Finding all the base paths

To get all the base paths available, hit the url http://localhost:8080/routes. Response format:

[
    <list_of_all_base_paths>
]

Auto-reload updated pages

When a page (or directory) is created, updated or deleted, the server will detect it and make the necessary changes to the URL routes without restart being necessary.

Find the latest release here.

Clone this wiki locally