Draft:Template:Article: Difference between revisions

From AbhiprayaVedi
No edit summary
Tag: Reverted
No edit summary
Tags: Manual revert Reverted
Line 1: Line 1:
<includeonly>{{DISPLAYTITLE:{{{DisplayTitle|{{{Title|}}}}}}}}<!--
<includeonly>
--><div class="article-container" data-language="{{{Language|}}}">
{{DISPLAYTITLE:{{{DisplayTitle|{{{Title|}}}}}}}}


<!-- Article Header -->
<div class="article-container" data-language="{{{Language|}}}">
 
<!-- 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="author-name">{{{Author|}}}</span>
    <span class="date-info">{{#time:d-m-Y|{{{Date|}}}}}</span>
<span class="date-info">{{#time:d-m-Y|{{{Date|}}}}}</span>
    <span class="category-badge">{{{Category|}}}</span>
<span class="category-badge">{{{Category|}}}</span>
  </div>
</div>
</div>
</div>


<!-- Introduction -->
<!-- Introduction - Compact -->
<div class="introduction-section">
<div class="introduction-section">
  {{{Introduction|}}}
{{{Introduction|}}}
</div>
</div>


Line 19: Line 21:
<div class="content-wrapper">
<div class="content-wrapper">


  <!-- Main Content -->
<!-- Main Content -->
  <div class="main-content">
<div class="main-content">


    <!-- Image 1 -->
<!-- Image 1 - Left Aligned -->
    {{#if:{{{Image1|}}}|
{{#if:{{{Image1|}}}|
    <div class="image-left">
<div class="image-left">
      [[File:{{{Image1}}}|thumb|400px|{{{Image1Caption|}}}]]
[[File:{{{Image1}}}|thumb|400px|{{{Image1Caption|}}}]]
    </div>
</div>
    |}}
|}}


    <!-- Article Text -->
<!-- Article Text -->
    <div class="article-text">
<div class="article-text">
      {{{Content|}}}
{{{Content|}}}
    </div>
</div>


    <!-- Image 2 -->
<!-- Additional Images -->
    {{#if:{{{Image2|}}}|
{{#if:{{{Image2|}}}|
    <div class="content-image">
<div class="content-image">
      [[File:{{{Image2}}}|thumb|center|650px|{{{Image2Caption|}}}]]
[[File:{{{Image2}}}|thumb|center|650px|{{{Image2Caption|}}}]]
    </div>
</div>
    |}}
|}}


    <!-- Source Attribution -->
<!-- Source Attribution -->
    {{#if:{{{SourceName|}}}|
{{#if:{{{SourceName|}}}|
    <div class="source-attribution">
<div class="source-attribution">
      <strong>സ്രോതസ്സ്:</strong> {{{SourceName|}}}
<strong>സ്രോതസ്സ്:</strong> {{{SourceName|}}}
      {{#if:{{{OriginalAuthor|}}}| • <strong>യഥാർത്ഥ രചയിതാവ്:</strong> {{{OriginalAuthor|}}}}}
{{#if:{{{OriginalAuthor|}}}| • <strong>യഥാർത്ഥ രചയിതാവ്:</strong> {{{OriginalAuthor|}}}}}
      {{#if:{{{SourceURL|}}}| • [{{{SourceURL|}}} യഥാർത്ഥ ലേഖനം]}}
{{#if:{{{SourceURL|}}}| • [{{{SourceURL|}}} യഥാർത്ഥ ലേഖനം]}}
    </div>
</div>
    |}}
|}}


  </div>
</div>


  <!-- Right Sidebar -->
<!-- Right Sidebar -->
  <div class="right-sidebar">
<div class="right-sidebar">


    <!-- Author Infobox -->
<!-- Author Infobox -->
    <div class="author-infobox">
<div class="author-infobox">
      {{#if:{{{Thumbnail|}}}|
{{#if:{{{Thumbnail|}}}|
      <div class="author-photo">
<div class="author-photo">
        [[File:{{{Thumbnail}}}|frameless|280px]]
[[File:{{{Thumbnail}}}|frameless|280px]]
      </div>
</div>
      |}}
|}}
      <div class="author-name-box">[[{{{Author|}}}|{{{Author|}}}]]</div>
<div class="author-name-box">[[{{{Author|}}}|{{{Author|}}}]]</div>
      {{#if:{{{Author_Bio|}}}|
{{#if:{{{Author_Bio|}}}|
      <div class="author-bio">
<div class="author-bio">
        {{{Author_Bio|}}}
{{{Author_Bio|}}}
      </div>
</div>
      |}}
|}}
    </div>
</div>


    <!-- Highlights -->
<!-- Highlights -->
    {{#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>
    |}}
|}}


    {{#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>
    |}}
|}}


    <!-- Key Points -->
<!-- Key Points as Floating Box -->
    {{#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>}}
        {{#if:{{{KeyPoint2|}}}|<li>{{{KeyPoint2|}}}</li>}}
{{#if:{{{KeyPoint2|}}}|<li>{{{KeyPoint2|}}}</li>}}
        {{#if:{{{KeyPoint3|}}}|<li>{{{KeyPoint3|}}}</li>}}
{{#if:{{{KeyPoint3|}}}|<li>{{{KeyPoint3|}}}</li>}}
        {{#if:{{{KeyPoint4|}}}|<li>{{{KeyPoint4|}}}</li>}}
{{#if:{{{KeyPoint4|}}}|<li>{{{KeyPoint4|}}}</li>}}
      </ul>
</ul>
    </div>
</div>
    |}}
|}}


  </div>
</div>


</div>
</div>


<!-- Categories -->
</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:{{{Category|}}}|{{{DisplayTitle|{{{Title|}}}}}}]]
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
{{#if:{{{Language|}}}|[[Category:{{{Language}}} articles|{{{DisplayTitle|{{{Title|}}}}}}]]|}}
{{#if:{{{Language|}}}|[[Category:{{{Language}}} articles|{{{DisplayTitle|{{{Title|}}}}}}]]|}}


<!-- Parallel categories -->
<!-- English-to-Malayalam parallel categories -->
{{#switch:{{{Category|}}}
{{#switch:{{{Category|}}}
|Politics=[[Category:രാഷ്ട്രീയം|{{{DisplayTitle|{{{Title|}}}}}}]]
|Politics=[[Category:രാഷ്ട്രീയം|{{{DisplayTitle|{{{Title|}}}}}}]]
Line 128: Line 143:
}}
}}
</includeonly>
</includeonly>
<noinclude>
== 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 ===
Instead of using `DEFAULTSORT`, we now pass the sort key '''directly on each category link''' using the pipe syntax:
<pre>
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
</pre>
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 ===
{| class="wikitable"
! Parameter !! Example value
|-
| Page name || <code>Something-In-The-Air</code>
|-
| DisplayTitle || <code>Something in the Air?</code>
|-
| Category shows || '''Something in the Air?''' ✓
|}
For Malayalam:
{| class="wikitable"
! Parameter !! Example value
|-
| Page name || <code>Kerala-Climate-Change</code>
|-
| DisplayTitle || <code>കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം</code>
|-
| Category shows || '''കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം''' ✓
|}
[[Category:Templates]]
</noinclude>

Revision as of 14:12, 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 കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം