Module talk:Signpost: Difference between revisions

Content deleted Content added
New fields: new section
Line 31:
:Looks like they begin some time around August. [https://en.m.wikipedia.org/wiki/Special:MobileDiff/1118064235 Here] is a diff with the weird text -- looks like it is coming in from SPT. '''[[User:JPxG|jp]]'''×'''[[User talk:JPxG|g]]''' 15:49, 4 November 2022 (UTC)
::{{ping|JPxG}} I have now [[Special:Diff/1121244116|fixed]] this. It was due to [[WP:SPT|SPT]] trying to get the article title by converting everything inside the {{tag|h2}} tags to text, but this included the subscribe link added by [[mw:Extension:DiscussionTools]]. This link was presumably added around August. I chose to fix this by getting the title from a new "data-signpost-article-title" attribute [[Special:Diff/1121239690|added]] to [[Wikipedia:Wikipedia Signpost/Templates/Signpost-article-header-v2]], and as a backup, getting it from the span inside the h2 tag with the class "mw-headline". I also went through and fixed all the instances where the "subscribe subscribe" links were added to the index modules. All signpost articles newly tagged since August had the "subscribe subscribe" text added, so it was not just limited to 2022 articles, although that's where the problem was most common. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr.&nbsp;Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪&nbsp;talk&nbsp;♪]]</sup> 08:52, 11 November 2022 (UTC)
 
== New fields ==
 
{{ping|Mr. Stradivarius}} Today I succeeded in writing something that I have wanted for quite some time, viz. a way to look at ''Signpost'' viewership statistics that isn't bad and useless. I'll be posting the source code soon, but basically, it does something very simple: it finds and records view counts for Signpost articles after publication (for a standardized interval afterwards, for purposes of comparison). Anyway, the reason this involves this module is as such:
 
Storing this data necessitates the creation of some large index of all ''Signpost'' articles, and rather than reinvent the wheel, I reckon it would be useful to do so in this module's indices, and I've found a way to make my script parse and update the Lua tables properly. I tested it briefly on [[Module:Signpost/index/2022]] (diff [https://en.wikipedia.org/w/index.php?title=Module:Signpost/index/2022&direction=next&oldid=1131685261 here] of what it looks like with the extra fields). I'm not very hot with Lua, so I don't know what this does on the backend utilities that use this module, but SPT works fine with these extra fields, as does [[Wikipedia talk:Wikipedia Signpost/Single/2022-01-30]] (which uses [[Wikipedia:Wikipedia Signpost/Templates/Single talk]], which uses [[Wikipedia:Wikipedia Signpost/Templates/Article list maker]], which uses Module:Signpost).
 
Anyway, I have everything working, and I am ready to add the fields to all the indices (only back to 2015 since per-page view counts aren't available before then), but I wanted to hold off and make sure that this isn't going to break everything first. What do you say? '''[[User:JPxG|jp]]'''×'''[[User talk:JPxG|g]]''' 08:19, 5 January 2023 (UTC)