Closed charliedotau closed 2 years ago
What is Twitter Card('s) metadata?
In some future instances OpenNEM might also display modelled data not just historical/regional data, any URL schema would need to considered extensibility beyond the constructs of historical NEM full and regional time periods. For instance a WA SWIS model that is using historical weather data but a model for 50% RE (or something).
i'm a big fan of this request — i'd like to be able to share a view by sending someone the URL, so, to the greatest extent possible, every piece of configurability for the page should be able to be put in the URL.
i'd also like to get the # out of the URL.
This would effectively be the bookmark FR sorted too. (maybe it would need some additional UI sugar)
What is Twitter Card('s) metadata?
Twitter Card metadata is the code you add to your HTML pages, so that your website is optimised for sharing on Twitter. In the case of OpenNem
the Twitter card code ensures that when the site's URL is tweeted, the tweet comes with some bells and whistles such as a thumbnail image, a title and a short description. See the attached screenshot, where I've highlighted in green the bits of the tweet automatically generated from the Twitter Card metadata.
Twitter provides a tool for previewing your site's Twitter Card metadata here (you need to be logged into twitter).
As I understand it, the Twitter Card metadata for opennem
is static: its the same irrespective of the URL that is tweeted. Ideally the Twitter Card metadata would update with the URL.
I've given some thought to the URL design. To my mind the only approach that really makes sense is to use query parameters, like so:
https://opennem.org.au/regions/vic?startDate=<<dateFormat>>&endDate=<<dateFormat>>
The proposed date format would be iso8061
so the full example would be
https://opennem.org.au/regions/vic?startDate=2018-01-31&endDate=2018-12-31
The benefits of this design are
Unix time
)iso8061
dates as described hereIt's probably worth outlining the scenarios that the URL design should support
the primary variables for a given region are
The units of the x-axis can be one of the following
Clearly then startDate
and endDate
is insufficient. How best to capture all of this in a URL?
If we were to focus to the URLS around the Moment in time
, we might design the URLs like so
/regions/sa/2018
(for calendar year)/regions/sa/2018/05
(for a month)/regions/sa/2018/W02/01
(for week) - see ISO Week Date/regions/sa/2018/05/31
(for a date)/regions/sa/2018/05/31/0930
(for date time)The benefits of this are:
iso8061
- meaning the coding is probably Financial Year
and Season
?These are outliers, so not sure how best to handle these.
Reporting Period
and Chart interval
?Potentially these could be captured as query strings, e.g
/regions/sa/2018/05/31?period=30D
/regions/sa/2018/05/31?period=1Y
Note in examples above - because we know the Moment in Time
is a timeless date, its implicit that the chart interval
is one day
Other examples
/regions/sa/2018/05?period=all
/regions/sa/2018/05/0930?period=7d&interval=30m
Just to throw a curve ball, I'm talking with Steven about the prospect of using OpenNEM to display energy modelling results, not just historical data, so if we were to extend this FR to that context, we would need some way to identify the model in questions, which could I suppose just be a variation on the /regions/sa e.g.
mysite.org.au/models/swis/50re/2014/01/01?period=1Y
mystic.org.au/models/nem/closeallcoal/2023/01/01?period=1Y
- various benefits of
iso8061
dates as described here
opennem already uses iso-8601
dates in the JSON data for the graph.
i think i probably not add the week num param as it makes the parsing more complicated and it's not consistent with the rest. The period
query should be enough there to cover the week num. /regions/sa/2018/W02/01
.
@aleith: for the models, it can be included as a query string instead. i.e. ?model=xxx
Hi @chienleng. I see where you're coming from. There's something there that doesn't sit right with me though, and I think it probably comes back to the related conversation around server vs client side.
When I designed those URLs, I wanted to ensure we were delivering distinct, canonical pages. But what does that mean exactly? It's more than just a unique URL.
To my mind, a canonical page, that is easily indexed by Google and readily shared on the Socials comprises as much of the following as possible:
Page Title
and Meta Description
(Google hates nothing more than duplicate titles)
3, some distinct page content ( ideally a unique H1
tag and some unique copy. thumbnail
, to aide sharability with Twitter etc. Google
but also Twitter
(see below).If we strive for the above, this inevitably raises the server-side vs client-side question. Whilst Google is getting better at crawling client side, there are other considerations. Twitter for instance, cache's the metadata it gleans from the website that it uses to render the preview (what they call the Twitter Card
):
quote: "Our web crawlers re-index the Card tag information on your page roughly every week."
This needs to be factored in, when considering the best implementation. (not to mention the challenge that you've already raised around generating those thumbnails in the first place, server side).
This brings us back to the URL design. @chienleng: let's take your suggestion to @aleith about models. If using a query parameter as you've suggested, to distinguish historical data from model data can be achieved, whilst meeting the canonical page criteria I set out above, then great. However If using a query parameter necessitates a particular implementation that can't easily achieve those criteria, then I'd suggest we steer away from it, and look at a different way.
I'd say the same question applies regarding your suggestion for handling weeks
.
In other words, its hard to appraise a specific URL design without also considering the implementation.
@chienleng Is there a simple solution, whereby we essentially have one static index.html
per distinct URL (route?)?
sorry for the essay.
Re implementation, I think the important thing is to have a sensible URL design that works as a way to get to the time period when people share the link. I don’t think at this stage we are able to implement the server side component that can generate/save a user-defined (date, chart, user defined description etc) image output to be served for Twitter, and still unconvinced we need to do that yet.
The canonical pages for OpenNEM are the regions (/nem, /sa, etc), with different sections (upcoming) that connects them /nem/energy
, /nem/generators
.
I like @charliedotau‘s idea of having years (and possibly months) in the params as they can be useful in certain context.
But we will still need to use query strings rather than params as they allow users to select a custom range that’s not defined by the param structure. With these three, we can cover almost all the use cases:
I am looking into using Nuxt.js (vuejs framework + static generated pages) to create static pages per route. So this hopefully should help with some of the issues of SPA. It will not create a static file for dynamic routes though.
Hi @chienleng
With your approach @chienleng, does that mean the pages you've identified as canonical can have a unique page title and description? This is really essential for SEO.
@charliedotau yep.
not quite the right solution, but we now have range
, interval
and filter
for the energy url.
i.e.https://opennem.org.au/energy/nem/?range=all&interval=1M&filter=february
@chienleng Your original proposal seems to be the right one. I don't think this feature request should be closed. It's a real limitation of this tool not be able to query historical data.
yes, I'd really like to see historical data queries with high resolution data (period= hourly or 5minute data) made possible. if the url schema allowed for automatic or url-based time-period data resolution switching we could even make a little online tool GUI for users to generate specific time period, region, data-resolution and technology grouping and selection requests using a simplified GUI dedicated to the task, that generates the appropriate URL link. For those who don't know the secrets of zooming into graphs and filtering technologies etc, it would make it more explicit and more discoverable.
I just put some related comments on this thread https://github.com/opennem/opennem-fe/issues/147
currently the URL doesn't reflect "zooming in" on data. And Zooming in on data doesn't regenerate data at a more appropriate resolution for the period (see below).
e.g. June 2019 QLD looks like this (see below) and the URL doesn't reflect the zoomed state.
https://opennem.org.au/energy/qld1/?range=all&interval=1M
← this shows all months on record in the database.
This one is feature request.
Given the new version of the site offers more options for the chart time periods, I think it makes sense to have these represented in the URL. So for instance, if you were to change the region to Victoria and select a time period of one year, the url would be something like
/#/regions/vic/year
or better still have the actual dates in the URL.The benefits of adding the timeframe to the URL may include:
better for sharing. If I tweet the aforementioned link for instance, the people who click on my tweet see on the website the same as what I was seeing). This would be particularly true if you put actual dates in the URL.
possibly better browser caching. Given browser caching works at the page level (and the browser defines a page via its URL), more granular URLs may result in more accurate browser caching
slightly better user experience - because the state of the app (which region and region time period is selected) is reflected not only in the app's UI but also via its URL
better search engine ranking. Google tends to like site's that have a sitemap (inferred from the URL structure) that is more than 1 level deep.
More granular reporting in
Google Analytics
. Because out of the box reporting in GA works via URL page views, having the time period in the URL would enable you to, for instance, determine which time periods generate the most page views.There are some technical considerations here. For instance, you may wish to update the Twitter Cards metadata, so that as the user chooses a different region or time period, the Twitter Card metadata updates accordingly (so that if someone tweets that URL, the tweet's auto generated metadata is consistent with the selected region/time-period).
ta Charlie