From e2fe2edcc175d5c243101c3def632600a4f419b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 29 Jan 2020 13:54:54 +0200 Subject: [PATCH] Title tags for documentation pages. --- hc/front/views.py | 1 + templates/docs/http_api.html | 34 ++++++++++++------------ templates/docs/http_api.md | 4 +-- templates/docs/introduction.html | 2 +- templates/docs/introduction.md | 2 +- templates/docs/monitoring_cron_jobs.html | 7 ++--- templates/docs/monitoring_cron_jobs.md | 4 +-- templates/front/docs_single.html | 15 +++++------ 8 files changed, 34 insertions(+), 35 deletions(-) diff --git a/hc/front/views.py b/hc/front/views.py index a41af575..ca7bc55c 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -283,6 +283,7 @@ def serve_doc(request, doc="introduction"): "section": "home", "section": doc, "content": content, + "first_line": content.split("\n")[0], } return render(request, "front/docs_single.html", ctx) diff --git a/templates/docs/http_api.html b/templates/docs/http_api.html index ab537cea..40625c65 100644 --- a/templates/docs/http_api.html +++ b/templates/docs/http_api.html @@ -53,15 +53,15 @@ minimizes the delay from your monitored service failing to you receiving an aler -
HTTP/1.1 200 OK
-Server: nginx
-Date: Wed, 29 Jan 2020 09:58:23 GMT
-Content-Type: text/plain; charset=utf-8
-Content-Length: 2
-Connection: close
-Access-Control-Allow-Origin: *
-
-OK
+
HTTP/1.1 200 OK
+Server: nginx
+Date: Wed, 29 Jan 2020 09:58:23 GMT
+Content-Type: text/plain; charset=utf-8
+Content-Length: 2
+Connection: close
+Access-Control-Allow-Origin: *
+
+OK
 
@@ -82,13 +82,13 @@ optional but enables a few extra features:

-
HTTP/1.1 200 OK
-Server: nginx
-Date: Wed, 29 Jan 2020 09:58:23 GMT
-Content-Type: text/plain; charset=utf-8
-Content-Length: 2
-Connection: close
-Access-Control-Allow-Origin: *
+
HTTP/1.1 200 OK
+Server: nginx
+Date: Wed, 29 Jan 2020 09:58:23 GMT
+Content-Type: text/plain; charset=utf-8
+Content-Length: 2
+Connection: close
+Access-Control-Allow-Origin: *
 
-OK
+OK
 
\ No newline at end of file diff --git a/templates/docs/http_api.md b/templates/docs/http_api.md index 015b90c5..9bb86695 100644 --- a/templates/docs/http_api.md +++ b/templates/docs/http_api.md @@ -63,7 +63,7 @@ GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/fail HTTP/1.0 Host: hc-ping.com ``` -``` +```http HTTP/1.1 200 OK Server: nginx Date: Wed, 29 Jan 2020 09:58:23 GMT @@ -94,7 +94,7 @@ GET /5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278/start HTTP/1.0 Host: hc-ping.com ``` -``` +```http HTTP/1.1 200 OK Server: nginx Date: Wed, 29 Jan 2020 09:58:23 GMT diff --git a/templates/docs/introduction.html b/templates/docs/introduction.html index 22cbb40b..cb6bb06c 100644 --- a/templates/docs/introduction.html +++ b/templates/docs/introduction.html @@ -1,4 +1,4 @@ -

SITE_NAME

+

SITE_NAME Documentation

SITE_NAME is a service for monitoring cron jobs and similar periodic processes:

  • SITE_NAME listens for HTTP requests ("pings") from services being monitored.
  • diff --git a/templates/docs/introduction.md b/templates/docs/introduction.md index 1cf35585..3fe20af8 100644 --- a/templates/docs/introduction.md +++ b/templates/docs/introduction.md @@ -1,4 +1,4 @@ -# SITE_NAME +# SITE_NAME Documentation SITE_NAME is a service for monitoring cron jobs and similar periodic processes: diff --git a/templates/docs/monitoring_cron_jobs.html b/templates/docs/monitoring_cron_jobs.html index 928c98da..d197afdd 100644 --- a/templates/docs/monitoring_cron_jobs.html +++ b/templates/docs/monitoring_cron_jobs.html @@ -38,15 +38,16 @@ increasingly important as you add more checks to your account.

    Take note of your check's unique ping URL

    -

    Finally, edit your crontab and append a curl or wget call after the command:

    +

    Finally, edit your cron job definition and append a curl or wget call +after the command:

    $ crontab -e
     # m h dom mon dow command
       8 6 * * * /home/user/backup.sh && curl -fsS --retry 3 PING_URL > /dev/null
     
    -

    Now, each time your cron job runs, it will send a HTTP request to the ping URL.

    -

    Since SITE_NAME knows the schedule of your cron job, it can calculate +

    Now, each time your cron job runs, it will send a HTTP request to the ping URL. +Since SITE_NAME knows the schedule of your cron job, it can calculate the dates and times when the job should run. As soon as your cron job doesn't report at an expected time, SITE_NAME will send you a notification.

    This monitoring technique takes care of various failure scenarios that could diff --git a/templates/docs/monitoring_cron_jobs.md b/templates/docs/monitoring_cron_jobs.md index 8bb80d30..c055d051 100644 --- a/templates/docs/monitoring_cron_jobs.md +++ b/templates/docs/monitoring_cron_jobs.md @@ -35,7 +35,8 @@ increasingly important as you add more checks to your account. 1. Take note of your check's unique **ping URL** -Finally, edit your crontab and append a curl or wget call after the command: +Finally, edit your cron job definition and append a curl or wget call +after the command: ```bash $ crontab -e @@ -44,7 +45,6 @@ $ crontab -e ``` Now, each time your cron job runs, it will send a HTTP request to the ping URL. - Since SITE_NAME knows the schedule of your cron job, it can calculate the dates and times when the job should run. As soon as your cron job doesn't report at an expected time, SITE_NAME will send you a notification. diff --git a/templates/front/docs_single.html b/templates/front/docs_single.html index 7e2a3263..e484b4d1 100644 --- a/templates/front/docs_single.html +++ b/templates/front/docs_single.html @@ -1,16 +1,13 @@ {% extends "front/base_docs.html" %} {% load compress static hc_extras %} -{% block title %}Documentation - {% site_name %}{% endblock %} -{% block description %} - -{% endblock %} -{% block keywords %} - -{% endblock %} +{% block title %}{{ first_line|striptags }} - {% site_name %}{% endblock %} +{% block description %}{% endblock %} +{% block keywords %}{% endblock %} - -{% block docs_content %}

    {{ content|safe }}
    {% endblock %} +{% block docs_content %} +
    {{ content|safe }}
    +{% endblock %} {% block scripts %} {% compress js %}