SwiftPackageIndex-Server
SwiftPackageIndex-Server copied to clipboard
SEO optimisation - Last Updated
We are specifying some dates to Google via the JSON-LD data, but it's still not showing a date against our package pages.
According to this page we should also specify datePublished in the JSON-LD, and also somewhere on the page put the words "Last updated:" with a fully specified date (not "x days ago") to get Google to report this data.
I am seeing date modified and created in a typical package page. It is put together in the 'PackageShow+View.swift' file.
Looking at the doc you linked, what is missing:
- JSON-LD level tag with the key dataPublished, which can be the same as dateCreated
- A human readable rendering on the page with content like:
Published February 4, 2019
Last updated: Feb 14, 2018
Yep! That's pretty much it. My understanding is that it doesn't matter where on the page the text is, just that it's beneficial for it to be user-visible. I'd suggest we put it towards the end of the package page, probably in a <small> tag below the README. We can play with the exact location once it's in the view.
I'd suggest we use first_commit_date and last_activity_at on repositories for the two dates.
Fixed via #1705
I had a reminder in to check in on the effect of this for today and I’m finding some interesting results.
Some search results that point to us still show no date. For example, Alamofire and SwiftLint:
Both of these packages have been in our index for a very long time, so my first thought was that Google hadn’t crawled them in a while. However, checking the search console, they were both crawled earlier today. So, my first thought was that this change hadn’t had any effect, but it has for other packages recently added to the index. For example, these two:
Both have dates, but the date that’s being used is inconsistent. PacketProcessor shows “13th April 2022” which is the “First published” date we put on the page. SwiftUIExtensions shows “6 days ago” which would have been the 3rd May which is the date of its last release, and is the date we show as “Last updated”.
I checked a few more packages that have had recent releases and couldn’t find any showing a date at all, just like Alamofire and SwiftLint.
I don’t think we need to do anything for now, and I’ll check again in a month.
Just a thought. I wonder if we should only put one date on the page. That'll teach Google to pick one randomly!
That would just be a matter of showing a last updated.
I just checked in on this again and the results are largely the same. Some packages show dates and some don't. There is some consistency in which packages show dates. I think it would be worth tweaking the display slightly to only show one date and to slightly amend the wording, so I will raise a PR today for that.
#1885 removes the first published date
Next changes, in at least one month:
- [ ] Remove the
<small> - [ ] Place the date further up the page at the bottom of the sidebar
I'm going to re-open for visibility, but #2021 is my next attempt at this. I can't really see how small would affect it, so I went with placing the date further up the page.
I will move the date back down and give up on this if this doesn't fix it.
I give up with this 🤷♂️
I know I said I give up with this, but I want to try one more thing that I had suggested to me recently.
We should put the date in a time tag with the datetime attribute set. 💡
Seems to have partially worked:
I know it would take some SQL work since it's not in the SearchView which is used, but would it help to set the last updated time on the sitemap.xml? It might enable Google to crawl faster.
Equally, assuming there's no valuable insights on the Google Search Console
This is great news!
I know it would take some SQL work since it's not in the SearchView which is used, but would it help to set the last updated time on the sitemap.xml? It might enable Google to crawl faster.
I think this is a good sign that it's now finding this metadata more reliably which is great.
Your idea is good, and I don't think bringing that data through into the search view is a bad idea, but it's likely that more and more packages will start getting this filled in over time now it's also finding it for Alamofire.
I had a reminder to check on this again today and I'm seeing the same results as @finestructure:
I'll check again in a month. Around and around we go :)
I checked again today and there's no change. Alamofire shows a date and SwiftLint doesn't.
Really, genuinely giving up on this now.
would it help to set the last updated time on the sitemap.xml? It might enable Google to crawl faster.
To revisit this, it's still not a bad idea but it won't help with this problem. Google crawls these pages often and the last time it hit the SwiftLint page was yesterday. It's choosing to ignore the information, I don't think it's an indexing frequency issue.
How do you double-close a thread? I'm done 😂