Вікі-код для Документація

Версія 5.1 додана 2024/05/18 22:46 автором Ashterix

Показати останніх авторів
1 {{documentTree showTranslations="false" showAttachments="false" root="xwiki:docs.WebHome" compact="true" readOnly="false" showWikis="true" showSpaces="true" showOnlyViewable="false" filterHiddenDocuments="false"/}}
2
3 {{velocity}}
4 {{html clean="false"}}
5 #set ($serverUrl = $xcontext.URLFactory.getServerURL($xcontext.context))
6 #set ($hasImages = false)
7 #macro(addOpenGraphTagsForAttachedImages $pageReference)
8 #set ($page = $xwiki.getDocument($pageReference))
9 #foreach ($attachment in $page.attachmentList)
10 #if ($attachment.isImage())
11 #set ($hasImages = true)
12 #set ($path= $page.getAttachmentURL($attachment.filename))
13 <meta property="og:image" content="$serverUrl$path" />
14 #end
15 #end
16 #end
17 <meta property="og:url" content="$doc.externalURL"/>
18 <meta property="og:type" content="article" />
19 <meta property="og:title" content="$tdoc.getRenderedTitle("plain/1.0")" />
20 ## Add all current page's image attachments as "og:image".
21 #addOpenGraphTagsForAttachedImages($doc.documentReference)
22 ## If current page has no attached image, add the ones of the home page, if any.
23 #set ($wikiDescriptor = $services.wiki.getById($xcontext.wiki))
24 #if (!$hasImages && $wikiDescriptor && $doc.documentReference != $wikiDescriptor.mainPageReference)
25 #addOpenGraphTagsForAttachedImages($wikiDescriptor.mainPageReference)
26 #end
27 {{/html}}
28 {{/velocity}}