Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#1828 consider keywords for display, DC and GoogleScholar indexing #1518

Merged
merged 6 commits into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions plugins/generic/dublinCoreMeta/DublinCoreMetaPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function articleView($hookName, $args) {
}

$i=0;
foreach (explode($article->getAuthorString(), ', ') as $author) {
foreach (explode(', ', $article->getAuthorString()) as $author) {
$templateMgr->addHeader('dublinCoreAuthor' . $i++, '<meta name="DC.Creator.PersonalName" content="' . htmlspecialchars($author) . '"/>');
}

Expand Down Expand Up @@ -119,9 +119,11 @@ function articleView($hookName, $args) {
$templateMgr->addHeader('dublinCoreSourceUri', '<meta name="DC.Source.URI" content="' . $request->url($journal->getPath()) . '"/>');

$i=0;
if ($subjects = $article->getSubject(null)) foreach ($subjects as $locale => $localeSubject) {
foreach (explode($localeSubject, '; ') as $subject) if ($subject) {
$templateMgr->addHeader('dublinCoreSubject' . $i++, '<meta name="DC.Subject" xml:lang="' . htmlspecialchars(substr($locale, 0, 2)) . '" content="' . htmlspecialchars($subject) . '"/>');
$dao = DAORegistry::getDAO('SubmissionKeywordDAO');
$keywords = $dao->getKeywords($article->getId(), array(AppLocale::getLocale()));
foreach ($keywords as $locale => $localeKeywords) {
foreach ($localeKeywords as $keyword) {
$templateMgr->addHeader('dublinCoreSubject' . $i++, '<meta name="DC.Subject" xml:lang="' . htmlspecialchars(substr($locale, 0, 2)) . '" content="' . htmlspecialchars($keyword) . '"/>');
}
}

Expand Down
12 changes: 7 additions & 5 deletions plugins/generic/googleScholar/GoogleScholarPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function articleView($hookName, $args) {
$templateMgr->addHeader('googleScholarJournalTitle', '<meta name="citation_journal_title" content="' . htmlspecialchars($journal->getName($journal->getPrimaryLocale())) . '"/>');
if (($issn = $journal->getSetting('onlineIssn')) || ($issn = $journal->getSetting('printIssn')) || ($issn = $journal->getSetting('issn'))) {
$templateMgr->addHeader('googleScholarIssn', '<meta name="citation_issn" content="' . htmlspecialchars($issn) . '"/> ');

}

foreach ($article->getAuthors() as $i => $author) {
Expand Down Expand Up @@ -91,17 +91,19 @@ function articleView($hookName, $args) {
foreach((array) $templateMgr->get_template_vars('pubIdPlugins') as $pubIdPlugin) {
if ($pubId = $article->getStoredPubId($pubIdPlugin->getPubIdType())) {
$templateMgr->addHeader('googleScholarPubId' . $pubIdPlugin->getPubIdDisplayType(), '<meta name="citation_' . htmlspecialchars(strtolower($pubIdPlugin->getPubIdDisplayType())) . '" content="' . htmlspecialchars($pubId) . '"/>');

}
}

$templateMgr->addHeader('googleScholarHtmlUrl', '<meta name="citation_abstract_html_url" content="' . $request->url(null, 'article', 'view', array($article->getBestArticleId())) . '"/>');
if ($language = $article->getLanguage()) $templateMgr->addHeader('googleScholarLanguage', '<meta name="citation_language" content="' . htmlspecialchars($language) . '"/>');

$i=0;
if ($subject = $article->getSubject(null)) foreach ($subject as $locale => $localeSubject) {
foreach (explode($localeSubject, '; ') as $gsKeyword) if ($gsKeyword) {
$templateMgr->addHeader('googleScholarKeyword' . $i++, '<meta name="citation_keywords" xml:lang="' . htmlspecialchars(substr($locale, 0, 2)) . '" content="' . htmlspecialchars($gsKeyword) . '"/>');
$dao = DAORegistry::getDAO('SubmissionKeywordDAO');
$keywords = $dao->getKeywords($article->getId(), array(AppLocale::getLocale()));
foreach ($keywords as $locale => $localeKeywords) {
foreach ($localeKeywords as $keyword) {
$templateMgr->addHeader('googleScholarKeyword' . $i++, '<meta name="citation_keywords" xml:lang="' . htmlspecialchars(substr($locale, 0, 2)) . '" content="' . htmlspecialchars($keyword) . '"/>');
}
}

Expand Down
3 changes: 2 additions & 1 deletion plugins/themes/default/styles/objects/article_details.less
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
}
}

.item.doi {
.item.doi,
.item.keywords {
padding-top: 0;

.label {
Expand Down
16 changes: 16 additions & 0 deletions templates/frontend/objects/article_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,22 @@
{/if}
{/foreach}

{* Keywords *}
{if !empty($keywords[$currentLocale])}
<div class="item keywords">
<span class="label">
{translate key="article.subject"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keywords label should have a : after it like the DOI, eg - Keywords: <list of keywords>.

</span>
<span class="value">
{foreach from=$keywords item=keyword}
{foreach name=keywords from=$keyword item=keywordItem}
{$keywordItem|escape}{if !$smarty.foreach.keywords.last}, {/if}
{/foreach}
{/foreach}
</span>
</div>
{/if}

{* Abstract *}
{if $article->getLocalizedAbstract()}
<div class="item abstract">
Expand Down