SwiftPackageIndex-Server icon indicating copy to clipboard operation
SwiftPackageIndex-Server copied to clipboard

SEO optimisation - Last Updated

Open daveverwer opened this issue 3 years ago • 10 comments

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.

daveverwer avatar Mar 23 '22 20:03 daveverwer

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

jeroenleenarts avatar Apr 14 '22 08:04 jeroenleenarts

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.

daveverwer avatar Apr 14 '22 11:04 daveverwer

I'd suggest we use first_commit_date and last_activity_at on repositories for the two dates.

daveverwer avatar Apr 14 '22 11:04 daveverwer

Fixed via #1705

finestructure avatar Apr 20 '22 13:04 finestructure

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:

Screenshot 2022-05-09 at 15 55 44@2x Screenshot 2022-05-09 at 15 57 44@2x

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:

Screenshot 2022-05-09 at 16 09 58@2x Screenshot 2022-05-09 at 16 10 10@2x

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.

daveverwer avatar May 09 '22 15:05 daveverwer

Just a thought. I wonder if we should only put one date on the page. That'll teach Google to pick one randomly!

daveverwer avatar May 09 '22 15:05 daveverwer

That would just be a matter of showing a last updated.

jeroenleenarts avatar May 09 '22 15:05 jeroenleenarts

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.

daveverwer avatar Jul 11 '22 11:07 daveverwer

#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

daveverwer avatar Jul 11 '22 12:07 daveverwer

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.

daveverwer avatar Sep 12 '22 12:09 daveverwer

I give up with this 🤷‍♂️

daveverwer avatar Oct 24 '22 10:10 daveverwer

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. 💡

daveverwer avatar Dec 22 '22 17:12 daveverwer

Seems to have partially worked:

CleanShot 2023-01-10 at 16 27 33@2x CleanShot 2023-01-10 at 16 28 44@2x

finestructure avatar Jan 10 '23 15:01 finestructure

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

Sherlouk avatar Jan 10 '23 15:01 Sherlouk

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.

daveverwer avatar Jan 10 '23 15:01 daveverwer

I had a reminder to check on this again today and I'm seeing the same results as @finestructure:

Screenshot 2023-01-23 at 14 59 55@2x Screenshot 2023-01-23 at 14 59 21@2x

I'll check again in a month. Around and around we go :)

daveverwer avatar Jan 23 '23 15:01 daveverwer

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.

daveverwer avatar Feb 27 '23 08:02 daveverwer

How do you double-close a thread? I'm done 😂

daveverwer avatar Feb 27 '23 08:02 daveverwer