Draft:Template:Article: Difference between revisions

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


<!-- Article Header - Clean, No Duplication -->
<!-- Article Header - Clean, No Duplication -->
<div class="article-header">
<div class="article-header">
<div class="author-info">
<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>
<span class="author-name">{{{Author|}}}</span>
<span class="date-info">{{{Date|}}}</span>
<span class="category-badge">{{{Category|}}}</span>
</div>
</div>
</div>


<!-- Introduction - Prominent but Compact -->
<!-- Introduction - Compact -->
<div class="introduction-section">
<div class="introduction-section">
{{{Introduction|}}}
{{{Introduction|}}}
Line 73: Line 69:
{{#if:{{{Highlight1|}}}|
{{#if:{{{Highlight1|}}}|
<div class="highlight-box">
<div class="highlight-box">
<div class="highlight-title">പ്രധാനം</div>
<div class="highlight-title">💡</div>
<div class="highlight-text">{{{Highlight1|}}}</div>
<div class="highlight-text">{{{Highlight1|}}}</div>
</div>
</div>
Line 80: Line 76:
{{#if:{{{Highlight2|}}}|
{{#if:{{{Highlight2|}}}|
<div class="highlight-box">
<div class="highlight-box">
<div class="highlight-title">പ്രധാനം</div>
<div class="highlight-title">💡</div>
<div class="highlight-text">{{{Highlight2|}}}</div>
<div class="highlight-text">{{{Highlight2|}}}</div>
</div>
</div>
Line 88: Line 84:
{{#if:{{{KeyPoint1|}}}|
{{#if:{{{KeyPoint1|}}}|
<div class="keypoints-float">
<div class="keypoints-float">
<div class="keypoints-header">പ്രധാന പോയിന്റുകൾ</div>
<div class="keypoints-header">📌</div>
<ul class="keypoints-list">
<ul class="keypoints-list">
{{#if:{{{KeyPoint1|}}}|<li>{{{KeyPoint1|}}}</li>}}
{{#if:{{{KeyPoint1|}}}|<li>{{{KeyPoint1|}}}</li>}}
Line 104: Line 100:
</div>
</div>


<!-- Categories - Bilingual -->
<!-- ================================================================
[[Category:{{{Category|}}}]]
    CATEGORIES
[[Category:Articles]]
   
{{#if:{{{Language|}}}|[[Category:{{{Language}}} articles]]|}}
    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.
    ================================================================ -->


<!-- English Category Names -->
[[Category:{{{Category|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
{{#if:{{{Language|}}}|[[Category:{{{Language}}} articles|{{{DisplayTitle|{{{Title|}}}}}}]]|}}
 
<!-- English-to-Malayalam parallel categories -->
{{#switch:{{{Category|}}}
{{#switch:{{{Category|}}}
|Politics=[[Category:രാഷ്ട്രീയം]]
|Politics=[[Category:രാഷ്ട്രീയം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Society=[[Category:സമൂഹം]]
|Society=[[Category:സമൂഹം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Culture=[[Category:സംസ്കാരം]]
|Culture=[[Category:സംസ്കാരം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Science=[[Category:ശാസ്ത്രം]]
|Science=[[Category:ശാസ്ത്രം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Literature=[[Category:സാഹിത്യം]]
|Literature=[[Category:സാഹിത്യം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Cinema=[[Category:സിനിമ]]
|Cinema=[[Category:സിനിമ|{{{DisplayTitle|{{{Title|}}}}}}]]
|Environment=[[Category:പരിസ്ഥിതി]]
|Environment=[[Category:പരിസ്ഥിതി|{{{DisplayTitle|{{{Title|}}}}}}]]
|Economics=[[Category:സമ്പദ്‌വ്യവസ്ഥ]]
|Economics=[[Category:സമ്പദ്‌വ്യവസ്ഥ|{{{DisplayTitle|{{{Title|}}}}}}]]
|Opinion=[[Category:അഭിപ്രായം]]
|Opinion=[[Category:അഭിപ്രായം|{{{DisplayTitle|{{{Title|}}}}}}]]
}}
}}


{{#if:{{{OriginalAuthor|}}}|
{{#if:{{{OriginalAuthor|}}}|
[[Category:Articles by {{{OriginalAuthor|}}}]]
[[Category:Articles by {{{OriginalAuthor|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
[[Category:Translations]]
[[Category:Translations|{{{DisplayTitle|{{{Title|}}}}}}]]
[[Category:Translated by {{{Author|}}}]]
[[Category:Translated by {{{Author|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
|
|
[[Category:Articles by {{{Author|}}}]]
[[Category:Articles by {{{Author|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
}}
}}
</includeonly>
</includeonly>


<noinclude>
<noinclude>
{{TemplateData|<nowiki>
== Ver3: Fix for Category Display Names ==
{
  "description": "Modern article template with bilingual category support and refined styling",
  "params": {
    "DisplayTitle": {
      "label": "Display Title",
      "description": "Article title (used for page title, not displayed in header)",
      "type": "string",
      "required": true
    },
    "Language": {
      "label": "Language",
      "description": "Article language",
      "type": "string",
      "required": true,
      "suggestedvalues": ["Malayalam", "English"]
    },
    "Author": {
      "label": "Author",
      "description": "Author name",
      "type": "string",
      "required": true
    },
    "Date": {
      "label": "Date",
      "description": "Publication date",
      "type": "date",
      "required": true
    },
    "Category": {
      "label": "Category",
      "description": "Article category (English name)",
      "type": "string",
      "required": true,
      "suggestedvalues": ["Politics", "Society", "Culture", "Science", "Literature", "Cinema", "Environment", "Economics", "Opinion"]
    },
    "Introduction": {
      "label": "Introduction",
      "description": "Article introduction",
      "type": "content",
      "required": true
    },
    "Content": {
      "label": "Content",
      "description": "Main article content",
      "type": "content",
      "required": true
    },
    "Thumbnail": {
      "label": "Author Photo",
      "description": "Author photo for infobox",
      "type": "wiki-file-name"
    },
    "Image1": {
      "label": "Image 1",
      "description": "First content image",
      "type": "wiki-file-name"
    },
    "Image1Caption": {
      "label": "Image 1 Caption",
      "type": "string"
    },
    "Image2": {
      "label": "Image 2",
      "description": "Second content image",
      "type": "wiki-file-name"
    },
    "Image2Caption": {
      "label": "Image 2 Caption",
      "type": "string"
    },
    "KeyPoint1": {"label": "Key Point 1", "type": "string"},
    "KeyPoint2": {"label": "Key Point 2", "type": "string"},
    "KeyPoint3": {"label": "Key Point 3", "type": "string"},
    "KeyPoint4": {"label": "Key Point 4", "type": "string"},
    "Highlight1": {"label": "Highlight 1", "type": "content"},
    "Highlight2": {"label": "Highlight 2", "type": "content"},
    "OriginalAuthor": {"label": "Original Author", "type": "string"},
    "SourceName": {"label": "Source Name", "type": "string"},
    "SourceURL": {"label": "Source URL", "type": "url"},
    "Author_Bio": {"label": "Author Bio", "type": "content"}
  }
}
</nowiki>}}


== How to Edit Key Points Position ==
=== The Malayalam DEFAULTSORT Problem ===


Key points appear as a floating box in the right sidebar. To move them elsewhere:
`{{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 ===
 
Instead of using `DEFAULTSORT`, we now pass the sort key '''directly on each category link''' using the pipe syntax:


1. In the template code, find the section:
<pre>
<pre>
<!-- Key Points as Floating Box -->
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
{{#if:{{{KeyPoint1|}}}|
<div class="keypoints-float">
...
</div>
|}}
</pre>
</pre>


2. Cut this entire section
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 ===


3. Paste it in one of these locations:
{| class="wikitable"
* **Top of main content**: After `<div class="main-content">`
! Parameter !! Example value
* **Within article text**: After `<div class="article-text">`
|-
* **Bottom of main content**: Before `</div>` that closes main-content
| Page name || <code>Something-In-The-Air</code>
|-
| DisplayTitle || <code>Something in the Air?</code>
|-
| Category shows || '''Something in the Air?''' ✓
|}


The CSS handles the floating automatically.
For Malayalam:
{| 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 കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം