Editing Comrade:CriticalResist/sandbox/Essays documentation

Warning: You are not logged in, comrade. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be instead attributed to your username.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
''If you’re looking at how to use the new essays page, refer to the user guide. This is the technical documentation for maintenance purposes.''  
''If you’re looking at how to use the new essays page, refer to the user guide. This is the technical documentation for maintenance purposes.''  


This page relies heavily on DPL3 (Dynamic Page List 3), documentation here: https://help.fandom.com/wiki/Extension:DPL3/Manual. DPL has a 1 day cache and will not update before then. To force it to update, go to the essays homepage and in the menu click on '''Soft Refresh'''.
This page relies heavily on DPL3 (Dynamic Page List 3), documentation here: https://help.fandom.com/wiki/Extension:DPL3/Manual. DPL has a 1 day cache and will not update before then. To force it to update, go to the essays homepage and in the menu click on '''Hard Refresh'''.


I’m unsure how much resources DPL needs to make the page, I can only hope the server supports the load once we start getting a lot of essays.
I’m unsure how many resources DPL needs to make the page, I can only hope the server supports the load once we start getting a lot of essays.


---
---
Line 14: Line 14:
* [[Template:Essay categories|Essay_categories]]
* [[Template:Essay categories|Essay_categories]]
* [[Template:Essay authors|Essay_authors]]
* [[Template:Essay authors|Essay_authors]]
** [[Template:Essays numberofworks|Essays numberofworks]] inside the above template
We also use two modules:


* [[Module:Reading time]] transcluded in the Infobox_essay template to estimate reading time. It can be invoked on any page though.
We also use one module ([[Module:Reading time]]) to estimate a reading time. It can be invoked on any page though.
* [[Module:Number of works]] which was made for the library to pull the number of pages (or "works") in a given category page, transcluded in Essays_numberofworks so that it can work with DPL on the author sidebar item.


While each template has its own stylesheet, we really only use the ones associated with Essays_homepage and Infobox_essay (found at /style.css). On MediaWiki, once a stylesheet is called on a page (through a template for example), it will apply to ''everything'' it can on that page. By selectively declaring properties in either essays_homepage or infobox_essay, we can control what appears (and how) on the new essays page (called the '''essays feed''') AND on individual '''essay pages''' (one such example: [[Essay:A nutrition and fitness guide]]) as well.
While each template has its own stylesheet, we really only use the ones associated with Essays_homepage and Infobox_essay (found at /style.css). On MediaWiki, once a stylesheet is called on a page (through a template for example), it will apply to ''everything'' it can on that page. By selectively declaring properties in either essays_homepage or infobox_essay, we can control what appears (and how) on the new essays page (called the '''essays feed''') AND on individual '''essay pages''' (one such example: [[Essay:A nutrition and fitness guide]]) as well.


This documentation goes through each template and the module one by one.
This documentation goes through each template and the module one by one.
== New category ==
You guessed it, I updated the essays page.
The documentation is still valid with just one addition: you need to add the '''Essays''' category to your essay to have it published. I also limited the count to 15 essays on the [[ProleWiki:Essays|front page]], and added a link to "all essays" at the end of the list, which takes you to the category page which uses the ''exact same code'' as the front page, except without the count limit for the feed (although I had to limit the width of the overall container because category pages are wider for some reason).
That's the only difference, I've updated the dpl codes below to reflect this.


== Essays_homepage ==
== Essays_homepage ==
Line 80: Line 70:
The code:<blockquote><nowiki><dpl></nowiki>
The code:<blockquote><nowiki><dpl></nowiki>


category = Essays
namespace = Essay


ordermethod = lastedit
ordermethod = lastedit
Line 94: Line 84:
addeditdate=true
addeditdate=true


titlemaxlength=57
titlemaxlength=60


userdateformat = Y-m-d format = ,\n* <span class="essay-small">%DATE%</span>, <span class="lastupdate-title">[[%PAGE%|%TITLE%]]</span>,
userdateformat = Y-m-d format = ,\n* <span class="essay-small">%DATE%</span>, <span class="lastupdate-title">[[%PAGE%|%TITLE%]]</span>,


</ dpl></blockquote>What it does is create a list of the 7 most recently updated essays (that is, when an edit was committed) **as long as they are in the Essays category**. You can change that 7 count to anything else in the template by editing '''count = 7''' in the DPL code.
</ dpl></blockquote>What it does is create a list of the 7 most recently updated essays (that is, when an edit was committed). You can change that 7 count to anything else in the template by editing '''count = 7''' in the DPL code.


titlemaxlength sets how many characters can appear in the title variable before we truncate it with ... I picked 57 (60-3 to account for the ellipses the code adds) so that it still looks good on desktop (about 2 full lines of text), but we can change it at any time.
titlemaxlength sets how many characters can appear in the title variable before we truncate it with ... I picked 60 so that it still looks good on desktop (about 2 full lines of text), but we can change it at any time.


Notably we also order by last edit (ordermethod), meaning the most recently updated essay will be pushed to the top of the list.
Notably we also order by last edit (ordermethod), meaning the most recently updated essay will be pushed to the top of the list.
Line 119: Line 109:
The code is otherwise pretty straightforward, it just repeats for every category with the names and links changed. I also reused the library module '''Number of works''' to count how many pages are in the category.
The code is otherwise pretty straightforward, it just repeats for every category with the names and links changed. I also reused the library module '''Number of works''' to count how many pages are in the category.


I chose to keep the Essay_categories manual instead of pulling it from DPL for two reasons: one, it kinda reduces the server load (again I don't know how much resources it takes to generate all this DPL code) and 2, it prevents people from creating categories and creating chaos. I totally expect that with time, some editors might not take the time to check if a category already exists and create their own duplicate. By adding categories manually, they can not only be named properly, but they can be discussed with the editorship too.
I chose to keep the Essay_categories manual instead of pulling it from DPL for two reasons: one, it kinda reduces the server load (again I don't know how many resources it takes to generate all this DPL code). and 2, it prevents people from creating categories and creating chaos. I totally expect that with time, some editors might not take the time to check if a category already exists and create their own duplicate. By adding categories manually, they can be  
 
The (X works) mention gets added by the [[Module:Number of works]].


== Essay_authors ==
== Essay_authors ==
Line 128: Line 116:
DPL pulls the contents of the category "Essays by author", simple as that. So you just need to add your author category (Essays by X) to that parent category. I provide the full code to also spice up your author category, since this is the category people will actually visit (Essays by author is really just sort of a holding or container category so that we can use DPL).
DPL pulls the contents of the category "Essays by author", simple as that. So you just need to add your author category (Essays by X) to that parent category. I provide the full code to also spice up your author category, since this is the category people will actually visit (Essays by author is really just sort of a holding or container category so that we can use DPL).


So that everyone is equal, I made it so that the authors list is ordered by last update (''to the category''), meaning if you publish a new essay (or happen to remove one from the category, basically updating the category page in any way), you'll get bumped to the top.
So that everyone is equal, I made it so that the authors list is ordered by last update, meaning if you publish a new essay, you'll get bumped to the top. I think this can be useful for readers to kinda help them find editors they like (or just new content).
 
The module from just above is used here as well.


== Homepage setup ==
== Homepage setup ==
Line 152: Line 138:
<blockquote><nowiki><dpl></nowiki>
<blockquote><nowiki><dpl></nowiki>


category=Essays
namespace=Essay


mode=unordered
mode=unordered
Line 158: Line 144:
includesubpages=false
includesubpages=false


ordermethod= firstedit,pagetouched
ordermethod=firstedit


order=descending
order=descending
Line 165: Line 151:


<nowiki></dpl></nowiki></blockquote>
<nowiki></dpl></nowiki></blockquote>




Line 175: Line 160:


ordermethod= is how the output will be sorted. Firstedit means that it will list the output by first edit made, i.e. page creation. Lastedit is the last edit made (used for Latest Updates). There’s several other ordering methods available.
ordermethod= is how the output will be sorted. Firstedit means that it will list the output by first edit made, i.e. page creation. Lastedit is the last edit made (used for Latest Updates). There’s several other ordering methods available.
''Pagetouched'' is a bit different, basically it looks at when the page was last updated in such a way that the cache was refreshed. Since we grab pages by their inclusion in a category, we want to know when new pages are added to the category, not when the ''category page'' itself was updated (since we don't update a category page once it's created, meaning we go into the editor and commit an edit). You can categorize with more than one parameter and that's what we did, we first categorize by date of first edit, and then by page touched. Not entirely sure why this works but basically it ensures we get essays ordered by the date they got the category added for the first time only. Otherwise every time you updated your essay in any way it would get bumped to the top of the list.
I think it's technically possible that if you remove the Essays category and add it again you can bump your essay to the top of the feed but I trust our editors not to do that and play fair.


order=ascending or descending to sort the list one way or the other.
order=ascending or descending to sort the list one way or the other.


include= this is the important one. Include allows you to include something specific with your output, pulled from the page. In this case we pull the content of the infobox_essay template. You can go really deep with the include property, I recommend looking it up on the documentation.
include= this is the important one. Include allows you to include something specific with your output, pulled from the page. In this case we pull the content of the infobox_essay template.


This code together creates a bullet-point list ordered from most recent to oldest essay and pulls the infobox essay template under each bullet point.
This code together creates a bullet-point list ordered from most recent to oldest essay and pulls the infobox essay template under each bullet point.
Line 211: Line 192:
Random future stuff that I want to fix or implement on that page.
Random future stuff that I want to fix or implement on that page.


* Still work on image layout (especially because some get cut off), on both the feed and individual pages separately, but the problem is I know people are going to upload images without checking the aspect ratio (I do it all the time) and it needs to look good in both views AND mobile and desktop too. Could use max-height to cap the height for images that are too big.
* Add more sidebar items if we can find any.
* Add more sidebar items if we can find any.
* Make it so we can collapse sidebar items for mobile users (probably need JS due to MW HTML restrictions)
* Make it so we can collapse sidebar items for mobile users (probably need JS due to MW HTML restrictions)
*make the table of contents available (tried a few things already but it just doesn't get pulled by DPL on the feed page)
*make the table of contents available (tried a few things already but it just doesn't get pulled by DPL on the feed page)
*remove the "Essays by " mention in author sidebar item. Possible with DPL but then number of works doesn't work.
*remove the "Essays by " mention in author sidebar item. Possible with DPL but then number of works doesn't work.
*Allow essays to not show up on the feed if someone wants that for a reason. Could be combined with a personal blog page for every editor. Technically you just wouldn't include the infobox_essay template on your essay but then you don't get the formatted look with image, author, reading time etc.
*Make it so the DISPLAYTITLE tag (set through name parameter) also applies on DPL lists, for example in "Last updated" and also in the meta title tag for thumbnails.
ProleWiki upholds the abolition of private property, including intellectual property, so feel free to publish any work at will.
Cancel Editing help (opens in new window)