Join the Webstudio community

Updated last month

How to convert dynamic Unix timestamps to date?

At a glance

The community member is using HyvorBlogs as a CMS for their Webstudio Blog, and the XML Sitemap is generating dynamic URLs from the connected data. However, HyvorBlogs sends the date as a Unix timestamp, which is not a formatted date. This causes issues with Google Search Console, which can read the data but with failures. The community members discuss various ways to fix this, including using the Time component, converting the time format dynamically in the template, and opening an issue with HyvorBlogs. Eventually, they find a solution by using the XML Time Component, which is made possible with the help of another community member.

Useful resources
Hello together. I use HyvorBlogs as a CMS for my Webstudio Blog. The XML Sitemap ist generating dynamic URL's from the connected Data ${Post Item["updated_at"]}, but HyvorBlogs sends the Date as Unix timestamp. So the <lastmod> ist a Unix Code, not a formatted date. Google Search Console can read it, but with failures. Is there any way to fix/translate this inside expression Editor?
Attachment
Capture-2024-12-04-143222.png
2
O
S
I
38 comments
I see. But if the Page is document type "XML" there are no components like the time component available. Edit: I was not smart enough to copy/paste it...;-) THX
hmm, indeed this is an interesting oversight
normally though the right format should already come from the API
so hyvor blog is supposed to send it in the right format actually
@Oleg Isonen But they don't. The Time component is not working because we need the ISO 8601 standard like YYYY-MM-DD. And i've found no country which is formatting like this...
sounds like a problem, can you open an issue with HyvorBlogs and see what they say?
@Oleg Isonen Hyvor says, i have speak to you "Usually, you should be able to convert the time format dynamically in the template" LOL
"According to their docs (https://docs.webstudio.is/university/foundations/expression-editor), it looks like the expression editor only supports some basic operations."
In our API, unfortunately, there's currently no way to get a different datetime format in the output.
@Ivan Starkov wdyt
Did copy-paste time component works?
If yes lets allow it in xml
Only if we be able to format the date in W3C format, actually not
Is the output markup valid though? <lastmod><time></time></lastmod>
Does not render for now at all
I see. Last mod isn't very important. If you have it include it, if you don't it's not a problem. Still nice to support it though
The time component is not showing up in sitemap. It's never important if things not working πŸ˜‰
Dot is missing?
I tried too and it shows like this
Attachment
Screenshot_2024-12-04_at_11.24.27_AM.png
Weird, i see this
<lastmod>2024-12-04</lastmod>
Oh but is that using the time component?
I tried like this but it breaks rendering
Attachment
Screenshot_2024-12-04_at_11.28.35_AM.png
Plus I doubt <time> is okay in <lastmod> but was trying to publish and somehow test
Any solutions?
Great guys. The XML Time Component is working. Thx a lot! @Oleg Isonen
actually its thanks to @Ivan Starkov 🀣
Add a reply
Sign up and join the conversation on Discord