add custom popular heading to landing pages (#19147)
This commit is contained in:
@@ -155,6 +155,8 @@ For a layout named `layouts/article.html`, the value would be `article`.
|
|||||||
- Type: `Object`.
|
- Type: `Object`.
|
||||||
- Optional.
|
- Optional.
|
||||||
|
|
||||||
|
The list of popular links are the links displayed on the landing page under the title "Popular." Alternately, you can customize the title "Popular" by setting the `featuredLinks.popularHeading` property to a new string.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -163,6 +165,10 @@ featuredLinks:
|
|||||||
- /path/to/page
|
- /path/to/page
|
||||||
guides:
|
guides:
|
||||||
- /guides/example
|
- /guides/example
|
||||||
|
popular:
|
||||||
|
- /path/to/popular/article1
|
||||||
|
- /path/to/popular/article2
|
||||||
|
popularHeading: An alternate heading to Popular
|
||||||
```
|
```
|
||||||
|
|
||||||
### `showMiniToc`
|
### `showMiniToc`
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
{% render code-example-card for productCodeExamples as example %}
|
{% render code-example-card for productCodeExamples as example %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if productCodeExamples.length > 6 %}
|
||||||
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">{% data ui.product_landing.show_more %} {% octicon "arrow-right" %}</button>
|
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">{% data ui.product_landing.show_more %} {% octicon "arrow-right" %}</button>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="js-filter-card-no-results d-none py-4 text-center color-text-secondary font-mktg">
|
<div class="js-filter-card-no-results d-none py-4 text-center color-text-secondary font-mktg">
|
||||||
<div class="mb-3">{% octicon "search" width="24" %}</div>
|
<div class="mb-3">{% octicon "search" width="24" %}</div>
|
||||||
|
|||||||
@@ -71,9 +71,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if featuredLinks.popular %}
|
||||||
<div class="col-12 col-lg-{% if page.changelog %}4{% else %}6{% endif %} mb-4 mb-lg-0">
|
<div class="col-12 col-lg-{% if page.changelog %}4{% else %}6{% endif %} mb-4 mb-lg-0">
|
||||||
<div class="featured-links-heading mb-4 d-flex flex-items-baseline">
|
<div class="featured-links-heading mb-4 d-flex flex-items-baseline">
|
||||||
<h3 class="f4 text-normal text-mono text-uppercase color-text-secondary" id="popular"><a href="#popular">{% data ui.toc.popular_articles %}</a></h3>
|
<h3 class="f4 text-normal text-mono text-uppercase color-text-secondary" id="popular"><a href="#popular">{% if page.featuredLinks.popularHeading %}{{ page.featuredLinks.popularHeading }}{% else %}{% data ui.toc.popular_articles %}{% endif %}</a></h3>
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-style-none">
|
<ul class="list-style-none">
|
||||||
{% for link in featuredLinks.popular %}
|
{% for link in featuredLinks.popular %}
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if page.changelog %}
|
{% if page.changelog %}
|
||||||
<div class="col-12 col-lg-4 mb-4 mb-lg-0">
|
<div class="col-12 col-lg-4 mb-4 mb-lg-0">
|
||||||
|
|||||||
@@ -74,11 +74,26 @@ const schema = {
|
|||||||
},
|
},
|
||||||
featuredLinks: {
|
featuredLinks: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
properties: {
|
||||||
patternProperties: {
|
gettingStarted: {
|
||||||
'^[a-zA-Z-_]+$': {
|
|
||||||
type: 'array',
|
type: 'array',
|
||||||
items: { type: 'string' }
|
items: { type: 'string' }
|
||||||
|
},
|
||||||
|
guides: {
|
||||||
|
type: 'array',
|
||||||
|
items: { type: 'string' }
|
||||||
|
},
|
||||||
|
guideCards: {
|
||||||
|
type: 'array',
|
||||||
|
items: { type: 'string' }
|
||||||
|
},
|
||||||
|
popular: {
|
||||||
|
type: 'array',
|
||||||
|
items: { type: 'string' }
|
||||||
|
},
|
||||||
|
// allows you to use an alternate heading for the popular column
|
||||||
|
popularHeading: {
|
||||||
|
type: 'string'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user