Talk:Transclusion

Latest comment: 2 days ago by 호로조 in topic Afterthought

Afterthought edit

I think I should have created this page in the Help: namespace. (Anyway, it's in the default searchpath here.) Well, an admin might fix it.--Imz 19:16, 26 August 2007 (UTC)Reply[reply]

I may can help move stuff to the Help: namespace page of it, but what about this talk page? Should the admins merge it? Ajhalili2006 (talk) 06:45, 9 April 2022 (UTC)Reply[reply]
I also think using the help page is better. Considering there are translation subpages, it may be a bit difficult. SolidBlock (talk) 02:50, 28 June 2023 (UTC)Reply[reply]
I think it better for Help: namespace separately. In a perspective of function, the explanation of how to work and of how to use are subtly different in my opinion. The Help: is for the user. but, this page is too functional to explain for user. --호로조 (talk) 09:21, 22 February 2024 (UTC)Reply[reply]

Transclusion restriction edit

Is there a way i can create a page and then when i transclude it onto another page....i only want the top 3 results. Similar to doing a transclusion of the Recent Changes special page({{Special:Newpages/5}}). --Goldbishop 15:48, 20 July 2010 (UTC)Reply[reply]

Limiting Category Transclusion edit

Please point me in a better direction if there is one.

I'm trying to find a way to limit category transclusion such that a page created by a template is categorized, but if that page is then transcluded to another page via another template, the category is NOT. So far, by various placement of the

<noinclude> and <includeonly>'s,

I've gotten the categorization to jump around including categorization of the template itself instead of the page. What I CAN do is if I edit the page generated by the template and add to it the

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

to the end of it, THEN that page will be categorized, but it won't be when it is transcluded. My question: is there any way to enable a template to push

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

to a page without acting on it, such that the rest of the template works and the resulting page is categorized, but when it is transcluded, the

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

is recognized? I feel like I'm missing something.

--Glitch25 22:48, 17 March 2011 (UTC)Reply[reply]

Transclude Entire pages into another separate wiki edit

Hello, I would like to have pages in my wiki that are totally identical to certain pages in Wikipedia.org. I am including these pages as a convenience to my readers so they know what work has already been done on the subject.

Would transclusion do the job? What would be code?

--Ali.T 1:48 AM, Dec 1 2011 IRST

I have the same challenge edit

I want to use {{#lsth:}} to get the text prior to the first section on wikipedia pages, like https://en.wikipedia.org/wiki/MediaWiki, on a wikiversity page... --Stevesuny (talk) 13:42, 26 July 2023 (UTC)Reply[reply]

Partial transclusion edit

A version of Transclusion#Partial transclusion is also at w:en:Wikipedia:Transclusion#Partial transclusion. The problem with syncing articles and subpages has previously been discussed (Wikipedia talk:Summary style, Wikipedia:Village pump (technical) Wikitech-l). Has this been previously discussed here? Is this something that can be addressed in /trunk/extensions? I couldn't find anything obviously related on the Bug tracker, so will add something there, pointing here. Thanks for reading. -- Trevj (talk) 12:22, 7 February 2012 (UTC)Reply[reply]

Transclude only the name of the last contributor or author? edit

Hello! I am trying to determine how to transclude JUST the last contributor of a page or the author of the page. So in a template maybe that says "Under Construction" I would like to have something like a "variable call" or maybe more appropriately a "database call" that would output the name of the page author or the last contributor ... so that the page that is actually under construction uses {{Template:Under Construction}} which would then somehow on the actual page, show the last editor or author of that page, not the template, so for example if the last contributor of the under construction page was Bob but the last contributor of the {{Template:Under Construction}} template was Tom, I would want the page which is under construction to show Bob when you transclude the template into the page. A good example of this can be seen at {{Wikipedia:Template:Under Construction}}

Does anybody know of the code bit that would do this? I'm pretty sure it's very simple, but Google search, and mediawiki search, are failing me today.

--Dehvokahn 14:24, 8 Aug 2014 (EDT)

You're probably looking for {{REVISIONUSER}}. That always shows the very last editor of the page, though, so if someone other than the original author puts the Under Construction template on the page, it'll be their name that shows up. You can try and get fancy by using substitution, but honestly, I usually find it's more reliable to just add a parameter to the call so you know with certainty what'll show up. So your template might look something like This page is currently under construction by {{{1|the person who placed this here}}}. and then you'd call it with {{Under Construction|Dehvokahn}}. – RobinHood70 talk 00:50, 9 August 2014 (UTC)Reply[reply]

Something seriously wrong with section edit

I think vandalism made its way into this section: Transclusion#Example_of_how_to_transclude_the_lead_of_an_article. It reads nonsensically. And if it wasn't vandalized, then it needs to be rewritten, because the instructions are incoherent. WinterSpw (talk) 23:21, 1 March 2017 (UTC)Reply[reply]

It's not well-explained, but it's correctly written as is (give or take the bit about not renumbering...I'm not sure what that was all about). The short of it is: surround the section you want to transclude with <onlyinclude> and </onlyinclude> tags, then transclude that page normally. Robin Hood  (talk) 03:21, 3 March 2017 (UTC)Reply[reply]

Templates with sections edit

Dear everybody,
I'd appreciate some help about handling sections in templates.
In a certain wiki installation, I have a template section. Its content is

==section==

Its function ist to grant for uniform, changeable headlines. The problem is: If a section headline is produced with the template, it does not offer the edit-link for the section. If I reproduce the issue, another problem arises: the edit-link is displayed, but if I follow it, I end up in the template instead of the article where it is included.
So, is there a way to grant for a link that directs the user to editing the section produced with the template rather than to the template?
Thank you in advance!
Yours, Ciciban (talk) 10:25, 13 March 2017 (UTC)Reply[reply]

[edit]

The closest you can get is to add your own edit link to the template, but even that'll only add a full-page edit, not a section edit, since there's no built-in way to ask MediaWiki what section you're in. That code would look like this:
<span class="mw-editsection plainlinks"><span class="mw-editsection-bracket">[</span>[{{fullurl:{{FULLPAGENAME}}|action=edit}} {{int:editlink}}]<span class="mw-editsection-bracket">]</span></span>
==section==</nowiki>
Robin Hood  (talk) 22:34, 13 March 2017 (UTC)Reply[reply]

how to I use Transclusion to make the entire content of a template be added to a page? edit

how to I use Transclusion to make the entire content of a template be added to a page? I know there is a command with I add at:

{{hereTEMPLATENAME}}

Moscowamerican (talk) 14:11, 21 July 2017 (UTC)Reply[reply]

Found it: Help:Substitution Moscowamerican (talk) 14:12, 21 July 2017 (UTC)Reply[reply]

Transclusion in namespaces edit

Hi All,

I am looking at adding a template to all the pages on the User: namespace, can this be done using the namespace, or does the template need to be added to each individual page? Squeak24 (talk) 11:53, 30 November 2017 (UTC)Reply[reply]

I think what you're looking for is an edit notice. For User space, you would add the template to MediaWiki:Editnotice-2. If you want to do User talk space, you'd add it to MediaWiki:Editnotice-3. Robin Hood  (talk) 17:09, 30 November 2017 (UTC)Reply[reply]

Is it possible to transclude a specific version of a page? edit

If I load an older revision of a page it will show the current transcluded content. Is there any way to transclude a specific version of a page to keep both pages synchronized without losing transclusion entirely? --CptTwinkie (talk) 22:33, 11 September 2018 (UTC)Reply[reply]

>> I have the exact same question! I'm attempting to assemble a "book" article that is an assemblage of transcluded content from several different wiki articles, which are each version controlled with the ApprovedRevs extension. The transcluded content DOES include only the latest "approved" version of a page, so you can control what is transcluded with ApprovedRevs. However, for "older" versions of the "book", it would be nice to transclude the content of the articles that were "baselined" at the time of the first book publishing. Is there a template or could there be a template that provides transclusion of content from a specific version of a wiki article? Skunkmantrek (talk) 12:54, 1 October 2018 (UTC)Reply[reply]

Sexist writing in the example edit

Can we remove the bit about a man with seven wives from the example? Simsong (talk) 12:13, 13 June 2019 (UTC)Reply[reply]

Transclude and API edit

Is there a way to transclude the 3 last recent changes AND configure the way they are displayed? I mean transclude and use the API (rcprop)? — Preceding unsigned comment added by Victorwiki82 (talkcontribs) 15:20, 6 November 2019 (UTC)Reply[reply]

Possible to exclude a template for further transclusions ? edit

I have a page A with a template {{Header}}

I'd like to transclude A into a page B, but without the content of {{Header}}

Is there a way to do that ?

--Varlin (talk) 21:32, 7 July 2021 (UTC)Reply[reply]

Yes. This is what the <noinclude>...</noinclude> tags are meant to help with. See Help:Transclusion#<noinclude> for more information. --BDavis (WMF) (talk) 23:13, 7 July 2021 (UTC)Reply[reply]
Yes but if I put <noinclude>SAMPLE</noinclude> in my template code, I do not have "SAMPLE" included on page A. I'd like that it be included in page A, but not in page B. Maybe it can be done by some sort of nesting noinclude tags, but I can't manage to do that. --Varlin (talk) 13:44, 11 July 2021 (UTC)Reply[reply]
If I'm understanding the problem, you have three pages involved in the setup: A, B, and Template:Header. You would like to see the Template:Header content when viewing A directly. You would also like to see the content of A when viewing B directly, but with the Template:Header content excluded. This would be possible if the wikitext of A wraps its transclude of Template:Header in <noinclude>...</noinclude> tags. I have made a basic example of the 3 pages to demonstrate this. --BDavis (WMF) (talk) 17:00, 11 July 2021 (UTC)Reply[reply]
Yes you got it, sorry my first sentence was equivocal indeed. I really appreciate your help. Unfortunately in my case, I can't have a "manual" workaround, because I have a series of "page A", whose content is generated by a template. So the only way would be if this template could add a <noinclude> tag onto page A. But it seems that is just not possible... --Varlin (talk) 23:16, 12 July 2021 (UTC)Reply[reply]
I have been wrestling withthis as well. My solution/work around is this: Page A_text = text of A. A = {{Header}} {{:A_text}}. B = (other things) {{:A_text}} . Put links various places that are helpful for getting to A, A_text, and B. I use various bullets and symbols for hidden links of convenience. — Preceding unsigned comment added by 2601:681:4201:1860:5d0c:a206:2803:1377 (talkcontribs) 21:31, 22 July 2021

Get a list of transclusion hierarchy edit

Is there any way to get a list of how the current template is transclusioned into the current page (with wiki text or Lua) So if e.g. current template A is transclusioned into template B which in turn is transclusioned into page Foo I want a list of the form [Foo, template:B, template:A] --Magol (talk) 10:14, 22 February 2022 (UTC)Reply[reply]

Extract details from a category page edit

I am interested in getting the name of the last article on a specific category page. This will obviously change as new articles are added: this is the intent. I am hoping there is a way to do it without API, but I can use this kind of thing to get the text of the list, but I still don't know how to get that last quoted string out of that list. https://en.wikipedia.org/w/api.php?cmtitle=Category:Saint%20Lucia%20geography%20stubs&action=query&format=json&list=categorymembers&cmlimit=452&cmprop=title Jrkenti (talk) 12:36, 15 April 2022 (UTC)Reply[reply]

Transcluding a page from a language other than English edit

hello, this extension doesn't have a problem, but I couldn't find a better place to write my problem.

I would like to transclude the page {{:wikinews:fr:Modèle:Market_Data}} but it doesn't display anything.

On the other hand it works well with {{:wikinews:Template:Stock_Market_data}}.

Is there a template for transcluding a page from a language other than English ?

For exemple: https://en.wikinews.org/wiki/User:Angelicadia/Sandbox/Exchange_rates/EUR2

Thanks

Angelicadia (talk) 22:51, 2 October 2023 (UTC)Reply[reply]

This is not possible on Wikimedia wikis. See Scary transclusion * Pppery * it has begun 00:25, 3 October 2023 (UTC)Reply[reply]
Oh, ok, thanks anyway for the answer and the link Angelicadia (talk) 01:55, 3 October 2023 (UTC)Reply[reply]

Auto transclude all subpages? edit

Hi all, I recently learned that Special:PrefixIndex can give you a list of all subpages of a given article, but I'm wondering if there is a way to list AND transclude them all?

Say, Example has Example/1 and Example/2. I want to be able to chuck something in Example that would return the contents of Example/1, Example/2, and any future subpages without specifically calling for them.

So, adding something like {{TranscludeAllSubpages}} on Example would result in this or something similar:

=Example=

Starting contents of Example

===Example/1===

Contents of Example/1

===Example/2===

Contents of Example/2

Continuing contents of Example

I did search for this on the internet but didn't find anything. Myirlname (talk) 11:47, 15 October 2023 (UTC)Reply[reply]

This is not currently possible AFAIK. * Pppery * it has begun 15:42, 15 October 2023 (UTC)Reply[reply]
Return to "Transclusion" page.