User:CohuttaBlue/Useful Code
Cohutta Blue's quick cheatsheet for often-used code:
Code to create references
[edit]Quick code for common reference types
Be sure to archive the URL if possible. Add the archive info inside the reference template, just before closing:
Archived URL info |archive-url=https://web.archive.org/web/00000000000000/https://originalnewspaperwebaddress |archive-date=Month 00, 0000 |url-status=dead
- REMOVE EACH 'x' TO USE ACTUAL REF AND TEMPLATE!
Cite book <xref name="something-short"> {x{cite book= |isbn=0-4397-0818-4 |url=http://www.wikipedia.org |title=title of source |author=authors, use commas for multiple |first=first name |last=last name |location=}x} </refx>
Cite news <xref name="something-short"> {x{cite news |author=n/a |title=Name of paper |url=https://newspaperwebaddress |publisher=Publisher of paper |location=Place of publication |page=X |date=Month 00, 0000 |accessdate=Month 00, 0000 }x} </refx>
Minimalist table
[edit]
|
Click "edit" to view the code for this table. I created this by copying code from Wikipedia's help section.
Transclusion
[edit]Transclude target page where "Pagename" is the target:
x{x{Namespace:Pagename}x}x
(Remove each "x" to deploy template.)
Note: subsequent pageloads of the page bearing this template will cause a tranclusion of the target page each time the current page is loaded. Changes made to the template are then automatically reflected on all pages into which that page has been transcluded (though a purge may sometimes be necessary).
To prevent deploying the template with every page load, use substitution, as below; if the article to be transcluded is in the mainspace, add the extra colon, as shown:
Substitution (transclude once):
x{x{subst::fullpagename}x}x
(Remove each "x" to deploy template.)
Note: By using substitution, above, subsequent pageloads will not result in further transclusions of the target page.
MY ATTEMPT TO USE TRANSCLUSION FOR THE FOLLOWING PAGE DID NOT WORK!
I have successfully used transclusion before. Some attempts failed. (I did of course remove the exes while trying to deploy the template):
FAILED OR ONLY PARTLY SUCCESSFUL CODE:
{x{subst:User:CohuttaBlue/Sandboxes#Moon-eyed_revision_plan_February_2021}x}
The transclusion function was successful, but it caused a transclusion of the full page (Sandboxes), not just the targeted section (Moon-eyed revision plan February 2021). I'm not sure why the above markup caused the full page (Sandboxes) to be transcluded instead of just one section of the page.
For more on transclusion, see Wikipedia page:
Help:Transclusion
Request Speedy Deletion
[edit]Template to request speedy deletion of own user subpage, page less than seven days old, no other editors on page:
{x{db-g7|rationale=DeletionRationale}x}
Replace "DeletionRationale w/reason, such as "ObsoleteDraft" or "TranscludedPageOldDraft."
Template to request deletion of any TEST PAGE of own user sandbox:
{x{Db-g2}x} {x{Db-u1}x}
g2 code: Delete test
u1 code: User request
Place one of the templates at the top of the sandbox subpage to be deleted. Remove the "x" from each bracket to make the deletion template live.