Module:Databox


This module provides an as simple as possible infobox system based on Wikidata.

An introductory presentation of Databox, given at the Wikidata Reuse Days 2022

It is fully automated, does not require any configuration to be used and does not have any declination based on the type of entity (person, place...).

How does it work?

This module is the backend code of the Databox template.

It uses the Wikidata item linked to the current page or the item which id is filled into the item parameter to automatically build an infobox.

Its basic algorithm is:


Easy to install instructions

Add the Module code
1. Copy-paste the Databox Module to your Wiki

  • Go to Module:Databox-Code and copy all contents in the code block.
  • Paste these contents into your own Wiki's Module:Databox page (if one doesn't exist yet, create one).

2. Add the sitelink of the newly-created Wikipedia page (Module:Databox) to the Wikidata item of Module:Databox (Q53931871)

Add the Template code
3. Copy-paste the following template code into your own Wiki Template:Databox page (if one doesn't exist yet, create one).

{{#invoke:Databox|databox|useImage={{{useImage|}}}|excludeProperties={{{excludeProperties|}}}}}

4. Connect the newly-created Template:Databox page to the Wikidata item of Template:Databox (Q20702632)

5. Test the template

  • Edit an article that is connected to a Wikidata item, for example, the capital City of your Country or Territory.
  • Enter the edit source view and add the template code {{Databox}} to the top of the page.
  • Preview the page to verify the databox appeared on the page, and publish to save your changes.
  • Congratulations, you have installed your first databox!


Edit Databox data

Sometimes data may be incorrect or outdated and needs to be changed or updated, but you cannot do that from the current page. Data seen in the databox is not stored locally, it is transcluded from Wikidata.

To change or edit data shown in databox:

  1. Click the pencil icon An icon from the OOjs UI lib. next to the statement in the databox.
  2. This will take you to where on the Wikidata item the statement is stored.
  3. Click the pencil icon An icon from the OOjs UI lib. again, on the side of the Statement box. This opens the edit mode on Wikidata.
    • Enter the new value in the input field. Add qualifiers or references as appropriate.
    • If the value is outdated but still correct (such as Census data), click the + icon to the right of the pencil icon instead, and enter the latest or newest value.
  4. Click the tick/checkmark button to publish the statement. The databox will immediately update and the new information will appear.


Notes

  1. The current display of quantities by Wikibase is very limited, this filter should be removed after improvements

Examples

Early Modern Swedish
chronolect
Subclass ofModern Swedish Edit
FollowsLate Old Swedish Edit
Followed byLate Modern Swedish Edit
Start time1526 Edit
End time1750 Edit
Entry in abbreviations tablevur Edit
Lucy
female given name
Part ofLucy Edit
Native labelLucy Edit
Latvian transcriptionLūsija Edit
IPA transcriptionˈluːsi Edit
Language of work or nameEnglish, Dutch Edit
Writing systemLatin script Edit
SoundexL200 Edit
Cologne phonetics58 Edit
CaverphoneLS1111 Edit
Name dayDecember 13 Edit
Family name identical to this given nameLucy Edit
Given name version for other genderLucius Edit
Attested infrequency of first names in the Netherlands, 2010 Edit
ethanol
type of chemical entity
Subclass offatty alcohol, alkanol Edit
Has usepolar protic solvent, medication, solvent Edit
Associated hazardethanol exposure Edit
Has effectethanol exposure, alcohol intoxication Edit
Conjugate baseethoxide Edit
Chemical formulaC₂H₆O Edit
Canonical SMILESCCO Edit
Crystal systemmonoclinic crystal system Edit
Point groupmonoclinic-domatic Edit
Space groupspace group Pn Edit
Safety classification and labellingNFPA 704: Standard System for the Identification of the Hazards of Materials for Emergency Response, Regulation (EC) No. 1272/2008 Edit
UN class3 Edit
UN packaging groupII Edit
NIOSH Pocket Guide ID0262 Edit
Active ingredient inalcoholic beverage, rectified spirit Edit
Physically interacts with5-hydroxytryptamine (serotonin) receptor 3A, Potassium inwardly-rectifying channel, subfamily J, member 3, Potassium inwardly-rectifying channel, subfamily J, member 5 Edit
Has characteristichygroscopy, Class IB flammable liquid Edit
Subject has rolelocal anti-infective agent, depressant Edit
NCI Thesaurus IDC2190 Edit
Hubble Space Telescope
space telescope
Part ofGreat Observatories program Edit
Native labelHubble Space Telescope Edit
Short nameHST Edit
FunderNational Aeronautics and Space Administration, European Space Agency Edit
Named afterEdwin Hubble Edit
Followed byCompton Gamma Ray Observatory, James Webb Space Telescope Edit
DeveloperMarshall Space Flight Center, Goddard Space Flight Center Edit
Country of originUnited States Edit
Start pointKennedy Space Center Launch Complex 39B Edit
Space launch vehicleSpace Shuttle Edit
OperatorGoddard Space Flight Center, Space Telescope Science Institute Edit
Launch contractorRockwell International Edit
UTC date of spacecraft launch24 April 1990 Edit
Time of object orbit decay2030s Edit
Parent astronomical bodyEarth Edit
Type of orbitlow Earth orbit Edit
ManufacturerLockheed Martin Missiles and Space, PerkinElmer Edit
Powered byspacecraft solar array, nickel–hydrogen battery Edit
Service entry20 May 1990 Edit
Official websitehttps://hubble.nasa.gov/, https://esahubble.org/ Edit
EpochJune 26, 2024 Edit
Category for the view of the itemCategory:Views of the Hubble Space Telescope Edit
Vesta
asteroid
Named afterVesta Edit
Follows3 Juno Edit
Followed by5 Astraea Edit
Significant eventnaming Edit
Discoverer or inventorHeinrich Wilhelm Olbers Edit
Time of discovery or invention29 March 1807 Edit
Site of astronomical discoveryBremen Edit
Minor planet groupasteroid belt Edit
Parent astronomical bodySun Edit
Asteroid familyVesta family Edit
Asteroid spectral typeV-type asteroid Edit
EpochNovember 21, 2025 Edit
Provisional designationA807 FA Edit
Unicode character Edit
atheism
world view, philosophical movement, doxastic attitude
Subclass ofirreligion, nontheism Edit
Hashtagatheism Edit
Has characteristicunbelief Edit
History of topichistory of atheism Edit
Used byatheist Edit
Stack Exchange taghttps://philosophy.stackexchange.com/tags/atheism, https://buddhism.stackexchange.com/tags/atheism, https://christianity.stackexchange.com/tags/atheism, https://islam.stackexchange.com/tags/atheism, https://hinduism.stackexchange.com/tags/atheism Edit
Opposite oftheism Edit
Iron Man
film
Part ofNational Film Registry Edit
TitleIron Man Edit
AssessmentBechdel test, reverse Bechdel Test Edit
Part of the seriesMarvel Cinematic Universe Edit
Genreaction film, science fiction film, adventure film, superhero film Edit
Has edition or translationIron Man, Iron Man Edit
Publication date2 May 2008, 30 April 2008, 30 April 2008, 1 May 2008 Edit
Country of originUnited States Edit
Original language of film or TV showEnglish Edit
Significant eventprincipal photography, première Edit
DirectorJon Favreau Edit
ScreenwriterMark Fergus, Hawk Ostby, Art Marcum, Matt Holloway Edit
Director of photographyMatthew Libatique Edit
Film editorDan Lebental Edit
Production designerJ. Michael Riva Edit
Costume designerLaura Jean Shannon, Rebecca Bentjen Edit
ComposerRamin Djawadi Edit
ProducerAvi Arad, Kevin Feige Edit
Production companyMarvel Studios, Paramount Pictures Edit
Distributed byParamount Pictures, Disney+, Walt Disney Studios Motion Pictures Edit
Soundtrack releaseIron Man Edit
Set in period2008 Edit
Narrative locationAfghanistan, Los Angeles, Kunar Province Edit
Aspect ratio (W:H)2.39:1 Edit
Colorcolor Edit
Review score94%, 7.6/10, 79/100 Edit
Takes place in fictional universeMarvel Cinematic Universe Edit
Distribution formatdigital download, video on demand Edit
BBFC rating12A certificate Edit
IFCO rating12A Edit
ClassInd rating12 Edit
CNC film rating (France)no age restriction Edit
Filmiroda ratingCategory II Edit
FPB rating10 Edit
FSK film ratingFSK 12 Edit
ICAA ratingNot recommended for children under 7 Edit
JMK film ratingfree from 12 years Edit
Kijkwijzer rating12 Edit
MPA film ratingPG-13 Edit
RTC film ratingB Edit
Official websitehttps://www.marvel.com/movies/iron-man Edit
Described at URLhttp://tw.movie.yahoo.com/movieinfo_main.html/id=2599 Edit
IMDA ratingPG Edit
Medierådet ratingFor ages 11 and up Edit
RCQ classificationG Edit
MTRCB ratingParental Guidance Edit
Airbus SAS
company
Industryaircraft and space construction Edit
Inception18 December 1969, 1970 Edit
Official nameAirbus Commercial Aircraft Edit
FounderRoger Béteille, Felix Kracht, Henri Ziegler, Franz Josef Strauß Edit
Chief executive officerGuillaume Faury Edit
Motto textWe make it fly, New standards. Together., De nouvelles normes. Ensemble. Edit
CountryFrance Edit
Member ofAerospace Valley, GIFAS, Linux Foundation, CVE Numbering Authority, Association of German Airports Edit
Legal formsociété par actions simplifiée Edit
Location of formationFrance Edit
Owned byAirbus SE, CASA Edit
Parent organization or unitAirbus SE Edit
Owner ofAtlas Elektronik, Airbus Military, Airbus Corporate Jets, Airbus Training Centre Europe Edit
Headquarters locationBlagnac Edit
IPv6 routing prefix2a00:6fc0:10::/44, 2a00:6fc0:690::/44, 2a00:6fc0:c010::/44 Edit
Official websitehttps://www.airbus.com/en/products-services/commercial-aircraft Edit
History of topichistory of Airbus Edit
ICAO airline designatorAIB Edit
Esperanto
planned language, international auxiliary language, a posteriori language, constructed language, modern language
Inception26 July 1887 Edit
Has usesecond language, lingua franca Edit
Native labelEsperanto Edit
Named afterDoktoro Esperanto Edit
MovementEsperanto movement Edit
AnthemLa Espero Edit
CultureEsperanto culture Edit
CountryEsperantujo Edit
Coordinate location53°0′0″N 23°0′0″E Edit
Location of formationWarsaw Edit
Foundational textUnua Libro Edit
FollowsProto-Esperanto Edit
CreatorL. L. Zamenhof Edit
Country of originRussian Empire Edit
Significant eventWorld Esperanto Congress 1905, World Esperanto Congress 1987 Edit
Linguistic typologyfree-order language, nominative–accusative language, agglutinative language, subject–verb–object Edit
Has grammatical caseaccusative case, nominative case Edit
Has grammatical numbersingular, plural Edit
Has tensepresent tense, past tense, future tense Edit
Has grammatical moodindicative, conditional, volitive Edit
Writing systemEsperanto alphabet, Esperanto Braille Edit
Uses capitalization forfull name, toponym Edit
Language regulatory bodyAcademy of Esperanto Edit
Signed formSignuno Edit
Ethnologue language status3 Wider Communication Edit
Studied byesperantology, interlinguistics Edit
Discoverer or inventorL. L. Zamenhof Edit
Described at URLhttps://cals.info/language/esperanto/, https://database.conlang.org/view/?conlang=195, http://inthelandofinventedlanguages.com/index.php?page=languages&id=83 Edit
HashtagEsperanto Edit
FlagEsperanto flag Edit
History of topichistory of Esperanto Edit
Practiced byEsperantist Edit
Used byEsperantist Edit
Category for music in this languageCategory:Esperanto-language music Edit
Related categoryCategory:Esperanto pronunciation Edit
Female form of labella langue espéranto Edit
IRC channel URLirc://irc.freenode.net/esperanto Edit
Stack Exchange site URLhttps://esperanto.stackexchange.com Edit
NCI Thesaurus IDC210835 Edit
Stack Exchange taghttps://conlang.stackexchange.com/tags/esperanto, https://linguistics.stackexchange.com/tags/esperanto, https://languagelearning.stackexchange.com/tags/esperanto, https://tex.stackexchange.com/tags/esperanto Edit
Wikimedia language codeeo Edit
Has listlist of Esperanto-language albums Edit
Category for maps or plansCategory:Esperanto-language maps Edit
Map
Berlin
seat of government, metropolis, Unitary municipality in Germany, urban municipality in Germany, city-state, independent city in Berlin, largest city, million city, federated state of Germany, federal capital, Hanseatic city, town divided by border, town divided by border
Part ofBerlin-Brandenburg Metropolitan Region, agglomeration of Berlin Edit
Inception1244 Edit
NameBá Linh, Béc-lin, Béc-lanh Edit
Official nameBerlin Edit
Native labelBerlin Edit
Short nameBerlín, B Edit
IPA transcriptionbərˈlɪn, bɛʁ.lɛ̃ Edit
Archives atLandesarchiv Berlin Edit
Official languageGerman Edit
ContinentEurope Edit
CountryGermany Edit
Capital ofGermany Edit
Located in the administrative territorial entityGermany Edit
Located in time zoneEurope/Berlin Edit
Enclave withinBrandenburg Edit
Coordinate location52°31′0″N 13°23′0″E Edit
Coordinates of easternmost point52°26′16″N 13°45′40″E Edit
Coordinates of northernmost point52°40′31″N 13°28′46″E Edit
Coordinates of southernmost point52°20′19″N 13°38′53″E Edit
Coordinates of westernmost point52°25′11″N 13°5′18″E Edit
Highest pointArkenberge Edit
Office held by head of governmentGoverning Mayor of Berlin Edit
Head of governmentKai Wegner Edit
Executive bodySenate of Berlin Edit
Legislative bodyBerlin House of Representatives Edit
Highest judicial authorityConstitutional Court of the State of Berlin Edit
Public holidayInternational Women's Day Edit
Twinned administrative bodyKyiv Edit
Shares border withBrandenburg Edit
ReplacesAlt-Berlin, East Berlin, West Berlin Edit
Language usedGerman, Berlin German Edit
Award receivedCity of Design, Princess of Asturias Award for Concord, Führerstadt Edit
Postal code10115–14199 Edit
Official appBerlin.de Service-App Edit
Official websitehttps://www.berlin.de/ Edit
Described at URLhttps://www.meyersgaz.org/place/10147053 Edit
Official map URLhttps://www.berlin.de/stadtplan/ Edit
HashtagBerlin Edit
Flagflag of Berlin Edit
Coat of armscoat of arms of Berlin Edit
Geography of topicgeography of Berlin Edit
History of topichistory of Berlin, timeline of Berlin Edit
Köppen climate classificationoceanic climate Edit
Related categoryCategory:Berlin-related lists Edit
Open data portalBerlin Open Data Edit
Economy of topiceconomy of Berlin Edit
Demographics of topicdemographics of Berlin Edit
District heating gridBerliner Fernwärmenetz Edit
Time of earliest written record1237, 1244 Edit
Mastodon instance URLhttps://berlin.social, https://mastodon.berlin Edit
Local dialing code030 Edit
Licence plate codeB Edit
Category for honorary citizens of entityCategory:Honorary citizens of Berlin Edit
Category for the view of the itemCategory:Views of Berlin Edit
Category for maps or plansCategory:Maps of Berlin Edit
Map
Douglas Adams
human
Sex or gendermale Edit
Country of citizenshipUnited Kingdom Edit
Name in native languageDouglas Adams Edit
Birth nameDouglas Noël Adams Edit
Given nameDouglas, Noël Edit
Family nameAdams Edit
PseudonymDavid Agnew Edit
Short nameDouglas Adams Edit
Date of birth11 March 1952 Edit
Place of birthCambridge Edit
Date of death11 May 2001 Edit
Place of deathSanta Barbara Edit
Manner of deathnatural causes Edit
Cause of deathmyocardial infarction Edit
Place of burialHighgate Cemetery Edit
FatherChristopher Douglas Adams Edit
MotherJanet Adams Edit
SiblingSusan Adams Edit
SpouseJane Belson Edit
ChildPolly Adams Edit
Native languageEnglish Edit
Languages spoken, written or signedEnglish Edit
Writing languageEnglish Edit
Field of workscience fiction literature Edit
EmployerBritish Broadcasting Corporation, The Digital Village Edit
Educated atBrentwood School, St John's College Edit
ResidenceCambridge, London, Brentwood, Santa Barbara Edit
Work locationLondon Edit
Start of work period1974 Edit
Ethnic groupWhite British Edit
Religion or worldviewatheism Edit
Eye colorbrown Edit
Instrumentguitar Edit
Notable workThe Hitchhiker's Guide to the Galaxy, Dirk Gently series, The Private Life of Genghis Khan Edit
Archives atSt John's College Library Edit
Member ofFootlights, Groucho Club Edit
Genrescience fiction, comedy, satire Edit
Award receivedInkpot Award, Ditmar Award for Best International Fiction Edit
Nominated forHugo Award for Best Dramatic Presentation, Locus Award for Best Science Fiction Novel Edit
Official websitehttps://douglasadams.com Edit
Described at URLhttps://baike.sogou.com/v367134.htm, https://baike.sogou.com/v815123.htm Edit
Related categoryCategory:Films with screenplays by Douglas Adams Edit
Copyright status as a creatorworks protected by copyrights Edit

No description.

Template parameters

ParameterDescriptionTypeStatus
fromfrom

Forces Databox to retrieve data from a specific Wikidata item (Q123) instead of page's linked Wikidata item.

Stringoptional
useImageuseImage

File name for the preferred image to use from Wikidata Entity

Stringoptional
excludePropertiesexcludeProperties

Comma separated list of Wikidata Property Ids to remove from the databox

Stringoptional

Wikitext Databox examples

The examples below show how the databox template can appear in the edit source view.

Default choice. It will retrieve data from the Wikidata item connected to the page.


Forces the databox to retrieve data from a specified Wikidata item. This can be a different item than the one connected/sitelinked to the page, but it cannot be both. Databox data can only be retrieved from one item.


Manually specify another image (P18) to display in the databox.


Specify a comma-separated list of Wikidata properties (PID's) that should not be shown in the current databox.


Combining parameters allows more content control.

How to use the new parameters

Step-by-step instructions to invoke and use the additional Databox parameters.

useImage

  1. Open the edit source view of a page you want to add Databox to, or edit an existing one.
  2. Add the code: |useImage=to the {{Databox}} template.
  3. Navigate to the Wikidata item of the connected databox, and find the Image (P18) statement. Tip: you can add #P18 to the of the Wikidata item URL to quickly navigate to it.
  4. To use a different image (locally) than the currently applied one, locate the filename (underneath the image itself) and highlight it and copy it (Ctrl+C).
  5. Navigate back to the page where you are invoking the {{Databox|useImage=}} and paste (Ctrl+V) the copied filename into the template.
  6. The template code should now look like: {{Databox|useImage=highlighted_text.jpg}}.
  7. Preview the changes to see the new image in the Databox, and publish the page to save your changes.

excludeProperties

  1. Add a {{Databox}} to a page or view an existing one, and notedown the Property ID/number of the rows and data you wish to hide from the local databox.
    1. You can do this quickly by hovering the mouse-cursor over the icon on the corresponding row of the databox.
    2. In the bottom of your browser-window, the URL of the corresponding property will be previewed, locate and notedown the PID of that URL.
      Example: if the URL looks like www.wikidata.org/wiki/Q123456#P789, notedown P789.
    3. Do the same for all rows/properties that are to be hidden.
  2. Add the code: |excludeProperties=to the {{Databox}} template.
  3. Add the Property ID/numbers to the databox template code, separated by a comma , e.g.
    {{Databox|excludeProperties=P789,P123,P456}}.
  4. Preview the changes to ensure the rows have been hidden from the databox, and publish the page to save your changes.

Please remember: This parameter only hides the property data, it does not remove or delete it and will not affect any other Databoxes on the local or other Wikis.

See also

Code

-- A more extensive version is stored and documented at the Swedish Wikipedia site, sv.wikipedia.org/wiki/Modul:Databox
-- It is supposed to work for any language.

-- Properties excluded for all Databoxes on the current site
local site_excluded_properties = {
    'P360', --is a list of
    'P4224', --category contains
    'P935', -- Commons gallery
    'P1472', -- Commons Creator page
    'P1612', -- Commons Institution page
    'P373', -- Commons category
    'P3722', -- Commons maps category
    'P1151', -- topic's main Wikimedia portal
    'P1424', -- topic's main template
    'P910', -- topic's main category
    'P1200', -- bodies of water basin category
    'P1792', -- category of associated people
    'P1464', -- category for people born here
    'P1465', -- category for people who died here
    'P1791', -- category of people buried here
    'P1740', -- category for films shot at this location
    'P2033', -- Category for pictures taken with camera
    'P2517', -- category for recipients of this award
    'P4195', -- category for employees of the organization
    'P1754', -- category related to list
    'P301', -- category's main topic
    'P971', -- category combines topics
    'P3876', -- category for alumni of educational institution
    'P1753', -- list related to category
    'P3921', -- Wikidata SPARQL query equivalent
    'P1204', -- Wikimedia portal's main topic
    'P1423', -- template's main topic
    'P1709', -- equivalent class
    'P3950', -- narrower external class
    'P2888', -- exact match
    'P1382', -- coincident with
    'P527', -- has part
    'P2670', -- has parts of the class
    'P3113', -- does not have part
    'P2737', -- union of
    'P2738', -- disjoint union of
    'P2445', -- metasubclass of
    'P1963', -- properties for this type
    'P3176', -- uses property
    'P1889', -- different from
    'P460', -- said to be the same as
    'P2959', -- permanent duplicated item
    'P2860', -- cites
    'P5125', -- wikimedia outline
    'P5008', -- on focus list of Wikimedia project
    'P2559', -- Wikidata usage instructions
    'P1343', -- described by source
    'P972', --  catalogu
    'P1282', -- OSM tag or key
    'P4839', -- Wolfram Language entity code
    'P6104', -- Maintained by Wikiproject
    'P5996' -- Category for films in this language
}

function valuesToKeys(array)
    local result = {}
    for _, v in pairs(array) do
        result[v] = true
    end
    return result
end

local p = {}

function p.databox(frame)
    local args = frame:getParent().args
    local argsLocal = frame.args

    local itemId = nil
    if args.item then
        itemId = args.item
    end

    local argsLocal = frame.args
    local useImage = nil
    if argsLocal.useImage then
        useImage = argsLocal["useImage"]
    end

	-- excludeProperties is a local parameter to exclude given properties for a Databox on a specific page
    local excludeProperties = {}
    if argsLocal.excludeProperties then
        for item in string.gmatch(argsLocal.excludeProperties, "[^,]+") do
          table.insert(excludeProperties, item)
        end
    end

    local lang = mw.language.getContentLanguage()
    local item = mw.wikibase.getEntity(itemId)

    if item == nil then
        mw.addWarning("Wikidata item not found")
        return ""
    end

    local databoxRoot = mw.html.create('div')
        :addClass('infobox')
        :css({
            float = 'right',
            border = '1px solid #aaa',
            ['max-width'] = '300px',
            padding = '0 0.4em',
            margin = '0 0 0.4em 0.4em',
        })

    --Title
    databoxRoot:tag('div')
        :css({
            ['text-align'] = 'center',
            ['background-color'] = '#f5f5f5',
            padding = '0.5em 0',
            margin = '0.5em 0',
            ['font-size'] = '120%',
            ['font-weight'] = 'bold',
        })
        :wikitext(item:getLabel() or mw.title.getCurrentTitle().text)

    --Image
    local databoxImage = nil
    if useImage and useImage ~= "" then
        local allWikidataImages = item:getAllStatements('P18')
        if #allWikidataImages >= 1 then
            for _, image in ipairs( allWikidataImages ) do
                if image.mainsnak.datavalue.value == useImage then
                    databoxImage = useImage
                    break
                end
            end
        end
    end
    if databoxImage == nil then
        local bestWikidataImages = item:getBestStatements('P18')
        if #bestWikidataImages >= 1 then
            databoxImage = bestWikidataImages[1].mainsnak.datavalue.value
        end
    end

    if databoxImage then
        databoxRoot
            :tag('div')
            :wikitext('[[File:' .. databoxImage .. '|frameless|300px]]')
    end

    --Table
    local dataTable = databoxRoot
        :tag('table')
        :css({
            ['text-align'] = 'left',
            ['font-size'] = '90%',
            ['word-break'] = 'break-word',
            ['width'] = '100%',
            ['table-layout'] = 'fixed',
        })

    dataTable:tag('caption')
    		 :addClass('notheme')
             :css({
                 ['background-color'] = '#f5f5f5',
                 ['font-weight'] = 'bold',
                 ['margin-top'] = '0.2em',
             })
             :wikitext(item:formatStatements('P31').value)

    local properties = mw.wikibase.orderProperties(item:getProperties())
    local site_excluded_properties_hash = valuesToKeys(site_excluded_properties)
    site_excluded_properties_hash['P31'] = true --Special property
    local excludeProperties_hash = valuesToKeys(excludeProperties)

    local edit_message = mw.message.new('vector-view-edit'):plain()
    for _, property in pairs(properties) do
        local datatype = item.claims[property][1].mainsnak.datatype
        local valueCount = #item:getBestStatements(property)
        if datatype ~= 'commonsMedia' and datatype ~= 'external-id' and datatype ~= 'quantity' and datatype ~= 'wikibase-property' and datatype ~= 'geo-shape' and datatype ~= 'tabular-data' and not site_excluded_properties_hash[property] and not excludeProperties_hash[property] and valueCount > 0 and valueCount <= 5 then
            local propertyValue = item:formatStatements(property)
            dataTable:tag('tr')
                :tag('th')
                    :attr('scope', 'row')
                    :wikitext(lang:ucfirst(propertyValue.label)):done()
                :tag('td')
                    :wikitext(frame:preprocess(propertyValue.value))
                    :wikitext('&nbsp;[[File:OOjs UI icon edit-ltr.svg|' .. edit_message .. '|12px|baseline|class=noviewer|link=https://www.wikidata.org/wiki/' .. item.id .. '#' .. property .. ']]')
        end
    end

    --Map
    local coordinates_statements = item:getBestStatements('P625')
    if #coordinates_statements >= 1 and coordinates_statements[1].mainsnak.datavalue and coordinates_statements[1].mainsnak.datavalue.value.globe == 'http://www.wikidata.org/entity/Q2' then
        --We build the call to mapframe
        local latitude = coordinates_statements[1].mainsnak.datavalue.value.latitude
        local longitude = coordinates_statements[1].mainsnak.datavalue.value.longitude
        local geojson = {
            type = 'Feature',
            geometry = {
                type = 'Point',
                coordinates = { longitude, latitude }
            },
            properties = {
                title = item:getLabel() or mw.title.getCurrentTitle().text,
                ['marker-symbol'] = 'marker',
                ['marker-color'] =  '#224422',
            }
        }
        databoxRoot:wikitext(frame:extensionTag('mapframe', mw.text.jsonEncode(geojson), {
            height = 300,
            width = 300,
            frameless = 'frameless',
            align = 'center',
            latitude = latitude,
            longitude = longitude,
            zoom = zoom
        }))
    end

    --Wikidata Link
    databoxRoot:tag('div')
        :css({
            ['display'] = 'flex',
            padding = '0.3em 0',
            ['width'] = '100%',
            ['font-size'] = '90%',
        })
        :addClass('databox-from-wikidata-link')
        :wikitext('&nbsp;[[File:Wikidata-logo.svg|22px|class=noviewer skin-invert|link=https://www.wikidata.org/wiki/' .. item.id .. ']]')
        :tag('div')
            :css({
                margin = '0.05em 0 0 0',
            })
            :wikitext('&nbsp;[[d:' .. item.id .. '|From Wikidata]]')

    return tostring(databoxRoot)
end

return p
Category:Pages using the Kartographer extension