RSS Feed, fixed date sort

This commit is contained in:
Nemo 2022-03-29 18:19:28 +05:30
parent 145ad2390e
commit 412c061450
6 changed files with 69 additions and 21 deletions

View File

@ -1,4 +1,4 @@
title: Plugo.io Data
title: Plugo.io Powerbanks List of locations
email: plugo@captnemo.in
description: >
Easily accessible website detailing where all plugo powerbanks are available.

8
_includes/head.html Normal file
View File

@ -0,0 +1,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
<link rel="alternate" type="application/rss+xml" title="RSS Feed for Plugo Powerbanks" href="{{ site.url }}{{site.baseurl}}/feed.xml" >
{%- seo -%}
</head>

16
_includes/location.html Normal file
View File

@ -0,0 +1,16 @@
{% assign city_lower_case = include.data.city|downcase %}
{{include.data.name}}<br>
{% if include.data.floor!="NA"%}{{include.data.floor}}, {%endif %}
{% assign address = include.data.address %}
{% for mapping in site.include.data.city %}
{% assign old=mapping[0] %}
{% assign new=mapping[1] %}
{% assign address = address|replace:old,new %}
{% endfor %}
{{address}}
<br>
{% assign w=include.data.website|strip %}
{% if w!="" %}<br><a href="{% if w contains 'http' %}{%else%}http://{%endif%}{{w}}" title="Website for {{include.data.name|strip}}">🔗</a>{%endif%}
<a href="geo:{{include.data.lat}},{{include.data.lng}};z=19" title='Open in Maps Application'>🗺</a>
{%comment%}8047112182 is Plugo's office number{%endcomment%}
{% if include.data.mobile %}{%unless include.data.mobile contains '8047112182' %} <a href="tel:{{include.data.mobile| strip}}" title="Link to call {{include.data.name | strip}}">📞</a>{%endunless%}{%endif%}

View File

@ -18,33 +18,20 @@ layout: default
{% assign locations = site.data.plugo|sort:'state' %}
{% assign total = 0 %}
{% for row in locations %}
<tr>
<tr id="{{row.id}}">
<td>
{%comment%}
{% assign state_lower_case = row.state|downcase %}
<!-- <td>{{site.data.city[city_lower_case] | default:row.city}}, {{site.data.state[state_lower_case] | default: row.state}}</td> -->
{% assign city_lower_case = row.city|downcase %}
<td>
{{row.name}}<br>
{% if row.floor!="NA"%}{{row.floor}}, {%endif %}
{% assign address = row.address %}
{% for mapping in site.data.city %}
{% assign old=mapping[0] %}
{% assign new=mapping[1] %}
{% assign address = address|replace:old,new %}
{% endfor %}
{{address}}
<br>
{% assign w=row.website|strip %}
{% if w!="" %}<br><a href="{% if w contains 'http' %}{%else%}http://{%endif%}{{w}}" title="Website for {{row.name|strip}}">🔗</a>{%endif%}
<a href="geo:{{row.lat}},{{row.lng}};z=19" title='Open in Maps Application'>🗺</a>
{%comment%}8047112182 is Plugo's office number{%endcomment%}
{% if row.mobile %}{%unless row.mobile contains '8047112182' %} <a href="tel:{{row.mobile| strip}}" title="Link to call {{row.name | strip}}">📞</a>{%endunless%}{%endif%}
{%endcomment%}
{% include location.html data=row %}
</td>
<td>{{row.business}}</td>
<td>{{row.totalAvailablePowerbanks}}</td>
{% if row.totalAvailablePowerbanks == 0 %}
{% assign zeroPowerBankLocations = zeroPowerBankLocations | plus:1 %}
{% endif %}
<td>{{row.createdAt | date_to_string}}</td>
<td data-sort="{{row.createdAt | date_to_xmlschema}}">{{row.createdAt | date_to_string}}</td>
{% assign total = total|plus:row.totalAvailablePowerbanks %}
<!-- <td>{%if row.isVisible %}☑{%else%}❌{%endif%}</td> -->
</tr>

35
feed.xml Normal file
View File

@ -0,0 +1,35 @@
---
---
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>
<channel>
<title>Plugo Powerbanks Location Availability</title>
<description>RSS Feed of Plugo.io locations. New locations will automatically send you a notification. </description>
<sy:updatePeriod>daily</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<link>{{ site.url }}{{site.baseurl}}</link>
<atom:link href="{{ site.url }}{{site.baseurl}}feed.xml" rel="self" type="application/rss+xml" />
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
{% assign locations = site.data.plugo | sort:'createdAt' | reverse %}
{% for row in locations limit:10 %}
<item>
<title>{{ row.name | xml_escape }}</title>
<description>{%capture description%}
{% include location.html data=row %}
<br>
Location Type: {{row.business}}
{%endcapture%}
{{ description | xml_escape }}</description>
<pubDate>{{ row.createdAt | date_to_rfc822 }}</pubDate>
<link>{{ site.url }}{{site.baseurl}}#{{row.id}}</link>
<guid>{{row.id}}</guid>
</item>
{% endfor %}
</channel>
</rss>

View File

@ -2,4 +2,6 @@
layout: home
---
[Plugo](https://plugo.io/) is "India's first smart & fully automated power bank rental service". They have a mobile app [[iOS](https://apps.apple.com/in/app/plugo/id1469215249), [Android](https://play.google.com/store/apps/details?id=com.plugo)] that provides information about where you can find their powerbanks, but the same is not accessible on the web. This page hosts republished (and slightly cleaned up) data from the Plugo app, updated on a regular schedule in an easily accessible and searchable format.
[Plugo](https://plugo.io/) is "India's first smart & fully automated power bank rental service". They have a mobile app [[iOS](https://apps.apple.com/in/app/plugo/id1469215249), [Android](https://play.google.com/store/apps/details?id=com.plugo)] that provides information about where you can find their powerbanks, but the same is not accessible on the web. This page hosts republished (and slightly cleaned up) data from the Plugo app, updated on a regular schedule in an easily accessible and searchable format.
A RSS feed is also available to get notified of new locations at [/feed.xml](/feed.xml).