title: Liferay Custom field from web content in velocity template
body: <p>I need to set some custom  tag in portal_normal.vm which define in each Web Content.</p>
  
  <p>My case:</p>
  
  <ol>
  <li>Go to Control Panel --> custom Field --> web content</li>
  <li>Create a new custom field called "custom_metas" </li>
  <li>Put this code in portal_normal.vm <code>&lt;meta property="og:title" content="$themeDisplay.getScopeGroup().getExpandoBridge().getAttribute('custom_metas')" /&gt;</code></li>
  </ol>
  
  <p>This code only works if custom field is created in site (not in web content). When I create in web content show as plain text.</p>
  
  <p>In my portal-ext.properties put: </p>
  
  <pre><code>journal.template.velocity.restricted.variables=
  </code></pre>
  
  <p>Nothing change.</p>
  
  <p>Finally I try this solution given in liferay forums but doesn't work. Notice: $reserved-article-id.data doesn't print nothing.</p>
  
  <pre><code>#set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
  #set ($ja = $journalArticleLocalService.getArticle($getterUtil.getLong($groupId),$getterUtil.getString($reserved-article-id.data)))
  #set ($resourceprimKey = $ja.getResourcePrimKey())
  
  #set ($assetEntryLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetEntryLocalService"))
  #set ($assetEntry = $assetEntryLocalService.getEntry("com.liferay.portlet.journal.model.JournalArticle", $resourceprimKey))
  
  #set($JournalArticleResourceLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleResourceLocalService"))
  
  #set ($journalArticleResource = $JournalArticleResourceLocalService.getArticleResource($assetEntry.getClassPK()))
  
  #set($JournalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
  
  #set ($journalArticle = $JournalArticleLocalService.getArticle($getterUtil.getLong($groupId), "$journalArticleResource.getArticleId()"))
  
  #set ($custom = $journalArticle.getExpandoBridge().getAttribute("custom_metas"))
  </code></pre>
  
  <p>$custom display as plain text</p>