如何将自定义字段的DOI等信息添加至源代码元数据适配Altmetrics检索?
Hey there! I get that adding custom metadata can feel tricky if you're not a dev pro—let's walk through exactly how to get your DOI, title, author, and ISSN values into the right meta tags so Altmetrics can pick them up.
Core Concept
Altmetrics relies on specific <meta> tags in your page's <head> section. Your job is to pull the values from your custom fields and output them in this standard format. Here's how to do it based on your setup:
1. Static HTML Sites
If you're working with plain HTML, just add these tags directly inside your <head> section, replacing the placeholder text with your actual custom field values:
<head> <!-- Altmetrics Citation Metadata --> <meta name="citation_doi" content="10.1234/your-doi-here"> <meta name="citation_title" content="Your Article's Full Title"> <meta name="citation_author" content="Jane Doe; John Smith"> <!-- Separate multiple authors with semicolons --> <!-- Only include the ISSN tag if you have that value --> <meta name="citation_issn" content="1234-5678"> </head>
2. WordPress (With Custom Fields Like ACF)
If you're using WordPress and have custom fields set up (like Advanced Custom Fields), you can dynamically pull these values and output the meta tags automatically.
Open your theme's header.php file, and add this code right before the closing </head> tag:
<?php // Pull values from your custom fields (replace the field names with yours!) $custom_doi = get_field('digital_object_identifier'); $custom_title = get_field('custom_article_title') ?: get_the_title(); // Fallback to post title if custom title is empty $custom_author = get_field('article_author'); $custom_issn = get_field('journal_issn'); ?> <!-- Output meta tags only if the value exists --> <?php if ($custom_doi) : ?> <meta name="citation_doi" content="<?php echo esc_attr($custom_doi); ?>"> <?php endif; ?> <meta name="citation_title" content="<?php echo esc_attr($custom_title); ?>"> <?php if ($custom_author) : ?> <meta name="citation_author" content="<?php echo esc_attr($custom_author); ?>"> <?php endif; ?> <?php if ($custom_issn) : ?> <meta name="citation_issn" content="<?php echo esc_attr($custom_issn); ?>"> <?php endif; ?>
Note: Replace digital_object_identifier, custom_article_title, etc., with the exact field names you set up in your WordPress custom fields.
3. Other CMS or Custom Codebases
No matter what platform you're using, the process boils down to two simple steps:
- Fetch the DOI, title, author, and ISSN values from your custom field storage (database, content manager, etc.)
- Generate
<meta>tags in the<head>section with the correctnameattributes (citation_doi,citation_title, etc.) and populate thecontentattribute with your custom values.
Always make sure to handle empty values—don't output a citation_issn tag if you don't have an ISSN to avoid clutter.
How to Verify It Works
After adding the tags:
- Right-click your page and select "View Page Source"
- Search for
citation_to confirm all the tags are present with the correct values - You can also use Altmetrics' own tools to test if they're picking up the metadata correctly.
内容的提问来源于stack exchange,提问作者Martin Schmidt




