Draft:Template:Article: Difference between revisions

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


<div class="article-container">
<!-- Article Header - Clean, No Duplication -->
 
<!-- Article Header - Sober Colors -->
<div class="article-header">
<div class="article-header">
<h1>{{{DisplayTitle|{{{Title|}}}}}}</h1>
<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>
 
<!-- Author Line - Single Line, Sober -->
<div class="author-line">
<span class="author-info">രചയിതാവ്: {{{Author|}}}</span>
<span class="date-info">തീയതി: {{{Date|}}}</span>
{{#if:{{{Category|}}}| • <span class="category-info">വിഭാഗം: {{{Category|}}}</span>|}}
</div>
</div>


<!-- Introduction - Immediately After Author Line -->
<!-- Introduction - Compact -->
<div class="introduction-box">
<div class="introduction-section">
{{{Introduction|}}}
{{{Introduction|}}}
</div>
</div>


<!-- Two Column Layout -->
<!-- Two Column Layout -->
<div class="two-column-layout">
<div class="content-wrapper">


<!-- Main Content Column (Left) -->
<!-- Main Content -->
<div class="main-content">
<div class="main-content">


<!-- Image 1 - Left Aligned at Beginning -->
<!-- Image 1 - Left Aligned -->
{{#if:{{{Image1|}}}|
{{#if:{{{Image1|}}}|
<div class="image-left">
<div class="image-left">
Line 34: Line 25:
|}}
|}}


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


<!-- Additional Images - Can be added manually in content -->
<!-- Additional Images -->
{{#if:{{{Image2|}}}|
{{#if:{{{Image2|}}}|
<div class="content-image">
<div class="content-image">
[[File:{{{Image2}}}|thumb|center|600px|{{{Image2Caption|}}}]]
[[File:{{{Image2}}}|thumb|center|650px|{{{Image2Caption|}}}]]
</div>
|}}
 
{{#if:{{{Image3|}}}|
<div class="content-image">
[[File:{{{Image3}}}|thumb|center|600px|{{{Image3Caption|}}}]]
</div>
</div>
|}}
|}}
Line 54: Line 39:
<!-- Source Attribution -->
<!-- Source Attribution -->
{{#if:{{{SourceName|}}}|
{{#if:{{{SourceName|}}}|
<div class="source-box">
<div class="source-attribution">
<div class="source-title">📰 സ്രോതസ്സ്</div>
<strong>സ്രോതസ്സ്:</strong> {{{SourceName|}}}
<div class="source-content">
{{#if:{{{OriginalAuthor|}}}| <strong>യഥാർത്ഥ രചയിതാവ്:</strong> {{{OriginalAuthor|}}}}}
<strong>പ്രസിദ്ധീകരണം:</strong> {{{SourceName|}}}
{{#if:{{{SourceURL|}}}| [{{{SourceURL|}}} യഥാർത്ഥ ലേഖനം]}}
{{#if:{{{OriginalDate|}}}|<br/><strong>തീയതി:</strong> {{{OriginalDate|}}}}}
{{#if:{{{OriginalAuthor|}}}|<br/><strong>യഥാർത്ഥ രചയിതാവ്:</strong> {{{OriginalAuthor|}}}}}
{{#if:{{{SourceURL|}}}|<br/><strong>ലിങ്ക്:</strong> [{{{SourceURL|}}} യഥാർത്ഥ ലേഖനം]}}
{{#if:{{{TranslationType|}}}|<br/><strong>തരം:</strong> {{{TranslationType|}}}}}
{{#if:{{{PermissionNote|}}}|<br/><em>{{{PermissionNote|}}}</em>}}
</div>
</div>
</div>
|}}
|}}
Line 72: Line 51:
<div class="right-sidebar">
<div class="right-sidebar">


<!-- Author Info Box (Like MediaWiki Infobox) -->
<!-- Author Infobox -->
{{#if:{{{Author|}}}|
<div class="author-infobox">
<div class="infobox author-box">
{{#if:{{{Thumbnail|}}}|
{{#if:{{{Thumbnail|}}}|
<div class="author-photo">
<div class="author-photo">
[[File:{{{Thumbnail}}}|frameless|280px|link={{{Author|}}}]]
[[File:{{{Thumbnail}}}|frameless|280px]]
</div>
</div>
|}}
|}}
<div class="author-name">[[{{{Author|}}}|{{{Author|}}}]]</div>
<div class="author-name-box">[[{{{Author|}}}|{{{Author|}}}]]</div>
{{#if:{{{Author_Bio|}}}|
{{#if:{{{Author_Bio|}}}|
<div class="author-bio-short">
<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-content">{{{Highlight1|}}}</div>
<div class="highlight-text">{{{Highlight1|}}}</div>
</div>
</div>
|}}
|}}
Line 99: 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-content">{{{Highlight2|}}}</div>
<div class="highlight-text">{{{Highlight2|}}}</div>
</div>
</div>
|}}
|}}


{{#if:{{{Highlight3|}}}|
<!-- Key Points as Floating Box -->
<div class="highlight-box">
<div class="highlight-title">💡 പ്രധാനം</div>
<div class="highlight-content">{{{Highlight3|}}}</div>
</div>
|}}
 
</div>
 
</div>
 
<!-- Floating Key Points Box -->
{{#if:{{{KeyPoint1|}}}|
{{#if:{{{KeyPoint1|}}}|
<div class="floating-keypoints">
<div class="keypoints-float">
<div class="keypoints-title">📌 പ്രധാന പോയിന്റുകൾ</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 130: Line 96:
</div>
</div>


<!-- Categories -->
</div>
[[Category:{{{Category|}}}]]
 
[[Category:Articles]]
</div>
{{#if:{{{Language|}}}|[[Category:{{{Language}}} articles]]|}}
 
<!-- ================================================================
    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|}}}}}}]]
}}
 
{{#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>
== Template Documentation ==
== Ver3: Fix for Category Display Names ==


This template creates a clean, two-column article layout with sober colors.
=== The Malayalam DEFAULTSORT Problem ===


=== Layout Structure ===
`{{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.
* **Header**: Title only (no duplication)
* **Author Line**: Single line with author, date, category
* **Introduction**: Directly below author line
* **Two Columns**:
** Left: Main content with left-aligned Image1
** Right: Author infobox, highlights
* **Floating Key Points**: Appears in content as needed


=== Usage ===
=== The Fix ===
Used automatically by Form:Article.


=== Image Placement ===
Instead of using `DEFAULTSORT`, we now pass the sort key '''directly on each category link''' using the pipe syntax:
* **Image1**: Left-aligned at content start
* **Image2-3**: Can be placed manually in content or at end
* **Thumbnail**: Used for author photo in infobox


=== Manual Image Insertion ===
In the Content field, you can insert images anywhere:
<pre>
<pre>
Your text here...
[[Category:Articles|{{{DisplayTitle|{{{Title|}}}}}}]]
</pre>


[[File:ImageName.jpg|thumb|right|300px|Caption]]
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.


More text...
=== How it works ===


[[File:AnotherImage.png|thumb|left|350px|Another caption]]
{| class="wikitable"
</pre>
! Parameter !! Example value
|-
| Page name || <code>Something-In-The-Air</code>
|-
| DisplayTitle || <code>Something in the Air?</code>
|-
| Category shows || '''Something in the Air?''' ✓
|}


=== Font Detection ===
For Malayalam:
To check which font is rendering:
{| class="wikitable"
# Right-click on Malayalam text
! Parameter !! Example value
# Select "Inspect" or "Inspect Element"
|-
# Look for "Computed" tab
| Page name || <code>Kerala-Climate-Change</code>
# Find "font-family" - shows which font is actually being used
|-
| 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 കേരളത്തിലെ കാലാവസ്ഥാ വ്യതിയാനം