Draft:Template:Article: Difference between revisions

From AbhiprayaVedi
No edit summary
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>{{DISPLAYTITLE:{{{DisplayTitle|{{{Title|}}}}}}}}<!--
{{DISPLAYTITLE:{{{DisplayTitle|{{{Title|}}}}}}}}
--><div class="article-container" data-language="{{{Language|}}}">


<!-- Main Article Title with Custom Styling -->
<!-- Article Header - Clean, No Duplication -->
<div class="article-title" style="font-size: 2.5em; color: #0645ad; font-weight: bold; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 3px solid #0645ad;">
<div class="article-header">
{{{DisplayTitle|{{{Title|}}}}}}
<div class="author-info"><span class="author-name">{{{Author|}}}</span><span class="date-info">{{#time:d-m-Y|{{{Date|}}}}}</span><span class="category-badge">{{{Category|}}}</span></div>
</div>
</div>


<!-- Article Metadata -->
<!-- Introduction - Compact -->
<div class="article-meta" style="color: #666; font-size: 0.9em; margin-bottom: 20px;">
<div class="introduction-section">
'''രചയിതാവ് (Author):''' {{{Author|}}} | '''തീയതി (Date):''' {{{Date|}}} | '''വിഭാഗം (Category):''' {{{Category|}}}
{{{Introduction|}}}
</div>
</div>


<!-- Main Content Area with Sidebars -->
<!-- Two Column Layout -->
<div style="display: flex; gap: 20px; margin: 20px 0;">
<div class="content-wrapper">


<!-- Left Sidebar - Key Points -->
<!-- Main Content -->
{{#if:{{{KeyPoint1|}}}|
<div class="main-content">
<div class="left-sidebar" style="flex: 0 0 200px; background: #fffacd; border: 2px solid #f0e68c; border-radius: 5px; padding: 15px; font-size: 0.9em;">
 
<div style="font-weight: bold; color: #8b4513; margin-bottom: 10px; font-size: 1.1em;">📌 പ്രധാന പോയിന്റുകൾ</div>
<!-- Image 1 - Left Aligned -->
<ul style="margin: 0; padding-left: 20px;">
{{#if:{{{Image1|}}}|
{{#if:{{{KeyPoint1|}}}|<li>{{{KeyPoint1|}}}</li>}}
<div class="image-left">
{{#if:{{{KeyPoint2|}}}|<li>{{{KeyPoint2|}}}</li>}}
[[File:{{{Image1}}}|thumb|400px|{{{Image1Caption|}}}]]
{{#if:{{{KeyPoint3|}}}|<li>{{{KeyPoint3|}}}</li>}}
{{#if:{{{KeyPoint4|}}}|<li>{{{KeyPoint4|}}}</li>}}
</ul>
</div>
</div>
|}}
|}}


<!-- Main Content Column -->
<!-- Article Text -->
<div class="main-content-column" style="flex: 1; min-width: 0;">
<div class="article-text">
{{{Content|}}}
</div>


<!-- Thumbnail -->
<!-- Additional Images -->
{{#if:{{{Thumbnail|}}}|
{{#if:{{{Image2|}}}|
<div style="float: right; margin: 0 0 15px 15px;">
<div class="content-image">
[[File:{{{Thumbnail}}}|thumb|300px|{{{ThumbnailCaption|}}}]]
[[File:{{{Image2}}}|thumb|center|650px|{{{Image2Caption|}}}]]
</div>
</div>
|}}
|}}


<!-- Introduction Section with Special Styling -->
<!-- Source Attribution -->
<div class="article-introduction" style="background: linear-gradient(to right, #e3f2fd, #ffffff); padding: 20px; margin: 0 0 25px 0; border-left: 5px solid #2196f3; border-radius: 3px; font-size: 1.15em; line-height: 1.8; color: #1565c0; font-weight: 500;">
{{#if:{{{SourceName|}}}|
{{{Introduction|}}}
<div class="source-attribution">
<strong>സ്രോതസ്സ്:</strong> {{{SourceName|}}}
{{#if:{{{OriginalAuthor|}}}| • <strong>യഥാർത്ഥ രചയിതാവ്:</strong> {{{OriginalAuthor|}}}}}
{{#if:{{{SourceURL|}}}| • [{{{SourceURL|}}} യഥാർത്ഥ ലേഖനം]}}
</div>
</div>
|}}


<!-- Main Article Content -->
<div class="article-content" style="font-size: 1.05em; line-height: 1.8; text-align: justify;">
{{{Content|}}}
</div>
</div>


<!-- Additional Images Section -->
<!-- Right Sidebar -->
{{#if:{{{Image1|}}}|
<div class="right-sidebar">
<div class="article-images" style="margin: 30px 0;">
 
{{#if:{{{Image1|}}}|
<!-- Author Infobox -->
<div style="margin: 20px 0; text-align: center;">
<div class="author-infobox">
[[File:{{{Image1}}}|thumb|center|600px|{{{Image1Caption|}}}]]
{{#if:{{{Thumbnail|}}}|
<div class="author-photo">
[[File:{{{Thumbnail}}}|frameless|280px]]
</div>
</div>
}}
|}}
{{#if:{{{Image2|}}}|
<div class="author-name-box">[[{{{Author|}}}|{{{Author|}}}]]</div>
<div style="margin: 20px 0; text-align: center;">
{{#if:{{{Author_Bio|}}}|
[[File:{{{Image2}}}|thumb|center|600px|{{{Image2Caption|}}}]]
<div class="author-bio">
</div>
{{{Author_Bio|}}}
}}
{{#if:{{{Image3|}}}|
<div style="margin: 20px 0; text-align: center;">
[[File:{{{Image3}}}|thumb|center|600px|{{{Image3Caption|}}}]]
</div>
}}
</div>
</div>
|}}
|}}
</div>
</div>


<!-- Right Sidebar - Highlights/Quick Facts -->
<!-- Highlights -->
{{#if:{{{Highlight1|}}}|
<div class="right-sidebar" style="flex: 0 0 220px; background: #e8f5e9; border: 2px solid #81c784; border-radius: 5px; padding: 15px; font-size: 0.9em;">
<div style="font-weight: bold; color: #2e7d32; margin-bottom: 10px; font-size: 1.1em;">💡 പ്രത്യേക ശ്രദ്ധയ്ക്ക്</div>
<div style="line-height: 1.6;">
{{#if:{{{Highlight1|}}}|
{{#if:{{{Highlight1|}}}|
<div style="background: white; padding: 10px; margin-bottom: 10px; border-radius: 3px; border-left: 3px solid #4caf50;">
<div class="highlight-box">
{{{Highlight1|}}}
<div class="highlight-title">💡</div>
<div class="highlight-text">{{{Highlight1|}}}</div>
</div>
</div>
}}
|}}
 
{{#if:{{{Highlight2|}}}|
{{#if:{{{Highlight2|}}}|
<div style="background: white; padding: 10px; margin-bottom: 10px; border-radius: 3px; border-left: 3px solid #4caf50;">
<div class="highlight-box">
{{{Highlight2|}}}
<div class="highlight-title">💡</div>
</div>
<div class="highlight-text">{{{Highlight2|}}}</div>
}}
{{#if:{{{Highlight3|}}}|
<div style="background: white; padding: 10px; border-radius: 3px; border-left: 3px solid #4caf50;">
{{{Highlight3|}}}
</div>
}}
</div>
</div>
|}}
<!-- Key Points as Floating Box -->
{{#if:{{{KeyPoint1|}}}|
<div class="keypoints-float">
<div class="keypoints-header">📌</div>
<ul class="keypoints-list">
{{#if:{{{KeyPoint1|}}}|<li>{{{KeyPoint1|}}}</li>}}
{{#if:{{{KeyPoint2|}}}|<li>{{{KeyPoint2|}}}</li>}}
{{#if:{{{KeyPoint3|}}}|<li>{{{KeyPoint3|}}}</li>}}
{{#if:{{{KeyPoint4|}}}|<li>{{{KeyPoint4|}}}</li>}}
</ul>
</div>
</div>
|}}
|}}
Line 97: Line 96:
</div>
</div>


<!-- Source Attribution Section -->
{{#if:{{{SourceName|}}}|
<div class="source-attribution" style="background: #fff3cd; border: 2px solid #ffc107; border-radius: 5px; padding: 20px; margin: 30px 0 20px 0;">
<div style="font-size: 1.2em; font-weight: bold; color: #856404; margin-bottom: 10px;">📰 സ്രോതസ്സ് / Source Attribution</div>
<div style="line-height: 1.6; color: #856404;">
{{#if:{{{TranslationType|}}}|<div style="margin-bottom: 5px;">'''തരം (Type):''' {{{TranslationType|}}}</div>}}
<div style="margin-bottom: 5px;">'''ഉറവിടം (Original Source):''' {{{SourceName|}}}</div>
{{#if:{{{OriginalAuthor|}}}|<div style="margin-bottom: 5px;">'''യഥാർത്ഥ രചയിതാവ് (Original Author):''' {{{OriginalAuthor|}}}</div>}}
{{#if:{{{OriginalDate|}}}|<div style="margin-bottom: 5px;">'''പ്രസിദ്ധീകരണ തീയതി (Publication Date):''' {{{OriginalDate|}}}</div>}}
{{#if:{{{SourceURL|}}}|
<div style="margin-top: 10px; padding: 10px; background: white; border-radius: 3px;">
'''യഥാർത്ഥ ലേഖനം (Original Article):''' [{{{SourceURL|}}} {{{SourceURL|}}}]
</div>
</div>
}}
 
{{#if:{{{PermissionNote|}}}|
<div style="margin-top: 10px; font-size: 0.9em; font-style: italic;">
{{{PermissionNote|}}}
</div>
</div>
<!-- ================================================================
    CATEGORIES
   
    NOTE on Malayalam DEFAULTSORT bug:
    MediaWiki's DEFAULTSORT cannot sort Malayalam Unicode text correctly —
    it only reads the first character, so categories show truncated names.
   
    FIX: We use the "sort key" parameter directly on each [[Category:]] link.
    The sort key is the DisplayTitle passed explicitly, which makes the full
    title appear correctly in the category listing.
    ================================================================ -->
[[Category:{{{Category|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
{{#if:{{{Language|}}}|[[Category:{{{Language}}} articles|{{{DisplayTitle|{{{Title|}}}}}}]]|}}
<!-- English-to-Malayalam parallel categories -->
{{#switch:{{{Category|}}}
|Politics=[[Category:രാഷ്ട്രീയം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Society=[[Category:സമൂഹം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Culture=[[Category:സംസ്കാരം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Science=[[Category:ശാസ്ത്രം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Literature=[[Category:സാഹിത്യം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Cinema=[[Category:സിനിമ|{{{DisplayTitle|{{{Title|}}}}}}]]
|Environment=[[Category:പരിസ്ഥിതി|{{{DisplayTitle|{{{Title|}}}}}}]]
|Economics=[[Category:സമ്പദ്‌വ്യവസ്ഥ|{{{DisplayTitle|{{{Title|}}}}}}]]
|Opinion=[[Category:അഭിപ്രായം|{{{DisplayTitle|{{{Title|}}}}}}]]
}}
}}
</div>
</div>
|}}


<!-- Author Bio Section -->
{{#if:{{{OriginalAuthor|}}}|
{{#if:{{{Author_Bio|}}}|
[[Category:Articles by {{{OriginalAuthor|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
<div class="author-bio" style="background: #f5f5f5; padding: 20px; margin: 30px 0 20px 0; border-top: 3px solid #9e9e9e; border-radius: 3px;">
[[Category:Translations|{{{DisplayTitle|{{{Title|}}}}}}]]
<div style="font-size: 1.3em; color: #424242; font-weight: bold; margin-bottom: 10px;">✍️ രചയിതാവിനെക്കുറിച്ച്</div>
[[Category:Translated by {{{Author|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
<div style="line-height: 1.6;">
|
{{{Author_Bio|}}}
[[Category:Articles by {{{Author|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
</div>
}}
</div>
|}}
 
<!-- Categories -->
[[Category:{{{Category|}}}]]
[[Category:Articles]]
[[Category:Articles by {{{Author|}}}]]
{{#if:{{{TranslationType|}}}|[[Category:Translations]]}}
</includeonly>
</includeonly>


<noinclude>
<noinclude>
== Article Template Documentation ==
== Ver3: Fix for Category Display Names ==
 
=== The Malayalam DEFAULTSORT Problem ===
 
`{{DEFAULTSORT:}}` does NOT work correctly with Malayalam (or any Unicode script that is non-Latin). MediaWiki's sort key mechanism only reads the first Unicode code point, which is why categories were showing only the first letter/character of the title.
 
=== The Fix ===


This template creates a beautifully formatted article page with:
Instead of using `DEFAULTSORT`, we now pass the sort key '''directly on each category link''' using the pipe syntax:
* Custom display title (supports Malayalam)
* Colored introduction section
* Optional left sidebar for key points
* Optional right sidebar for highlights
* Support for multiple images/charts within content
* Source attribution section for translations/republished content
* Author bio section
* Automatic categorization


=== Usage ===
<pre>
<pre>
{{Draft:Template:Article
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
|DisplayTitle=പ്രധാനപ്പെട്ട ലേഖനം
|Title=Important-Article
|Author=രചയിതാവിന്റെ പേര്
|Date=2026-01-13
|Category=Politics
|Thumbnail=Example.jpg
|ThumbnailCaption=Main image description
|Introduction=ലേഖനത്തിന്റെ ആമുഖം...
|Content=പ്രധാന ഉള്ളടക്കം...
|Image1=Chart1.png
|Image1Caption=First chart description
|Image2=Photo2.jpg
|Image2Caption=Second photo description
|Author_Bio=രചയിതാവിനെക്കുറിച്ച്...
|KeyPoint1=ആദ്യ പോയിന്റ്
|Highlight1=പ്രത്യേക ശ്രദ്ധയ്ക്ക്
|SourceName=The Hindu
|OriginalAuthor=Original Author Name
|OriginalDate=2026-01-10
|SourceURL=https://example.com/original-article
|TranslationType=Translation
|PermissionNote=Published with permission from the publisher
}}
</pre>
</pre>


=== Parameters ===
This tells MediaWiki: "place this page in the category, and display it under the sort key equal to the DisplayTitle." Since MediaWiki renders the sort key as the display label in category listings, the full Malayalam title now appears correctly.
'''Basic Information:'''
* '''DisplayTitle''' (required): Title as displayed on page (Malayalam supported)
* '''Title''' (required): Simple page name (English/numbers)
* '''Author''' (required): Author/Translator name
* '''Date''' (required): Publication date
* '''Category''' (required): Article category
 
'''Content:'''
* '''Thumbnail''' (optional): Main featured image filename
* '''ThumbnailCaption''' (optional): Caption for main image
* '''Introduction''' (required): Brief introduction with colored background
* '''Content''' (required): Main article text
 
'''Additional Images:'''
* '''Image1''' (optional): First additional image/chart
* '''Image1Caption''' (optional): Caption for first image
* '''Image2''' (optional): Second additional image/chart
* '''Image2Caption''' (optional): Caption for second image
* '''Image3''' (optional): Third additional image/chart
* '''Image3Caption''' (optional): Caption for third image


'''Sidebars:'''
=== How it works ===
* '''KeyPoint1-4''' (optional): Left sidebar key points
* '''Highlight1-3''' (optional): Right sidebar highlights


'''Source Attribution (for translations/republished content):'''
{| class="wikitable"
* '''SourceName''' (optional): Name of original publication
! Parameter !! Example value
* '''OriginalAuthor''' (optional): Original article author
|-
* '''OriginalDate''' (optional): Original publication date
| Page name || <code>Something-In-The-Air</code>
* '''SourceURL''' (optional): Link to original article
|-
* '''TranslationType''' (optional): Type (Translation, Adaptation, Reprint, etc.)
| DisplayTitle || <code>Something in the Air?</code>
* '''PermissionNote''' (optional): Note about permission obtained
|-
| Category shows || '''Something in the Air?'''
|}


'''Author Information:'''
For Malayalam:
* '''Author_Bio''' (optional): Information about the author
{| class="wikitable"
! Parameter !! Example value
|-
| Page name || <code>Kerala-Climate-Change</code>
|-
| DisplayTitle || <code>കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം</code>
|-
| Category shows || '''കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം'''
|}


[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Latest revision as of 18:56, 10 April 2026


Ver3: Fix for Category Display Names

The Malayalam DEFAULTSORT Problem

`` does NOT work correctly with Malayalam (or any Unicode script that is non-Latin). MediaWiki's sort key mechanism only reads the first Unicode code point, which is why categories were showing only the first letter/character of the title.

The Fix

Instead of using `DEFAULTSORT`, we now pass the sort key directly on each category link using the pipe syntax:

[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]

This tells MediaWiki: "place this page in the category, and display it under the sort key equal to the DisplayTitle." Since MediaWiki renders the sort key as the display label in category listings, the full Malayalam title now appears correctly.

How it works

Parameter Example value
Page name Something-In-The-Air
DisplayTitle Something in the Air?
Category shows Something in the Air?

For Malayalam:

Parameter Example value
Page name Kerala-Climate-Change
DisplayTitle കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം
Category shows കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം