Comments (2)
That hook works beautifully, thank you very much!
from mkdocs-material.
Thanks for suggesting. Insiders already allows to change many attributes for the default social card layouts by using the on_page_markdown
hook, which deliberately uses a "latest" event priority to allow other plugins and hooks to change metadata before the social card is queued up for rendering. Moving rendering to on_page_content
might be possible, but the problem is that the _title_from_render
might contain markup, which will jam the social plugin.
Sticking to the title MkDocs derives before rendering is safe in regards to that it does not contain markup. Also note, that there are currently issues with title handling in MkDocs:
It seems that it was fixed, but we're still awaiting a release. We can re-evaluate this request once the changes are finally released, because it is unclear whether the title from rendering can "just be used" due to the potential presence of markup or unresolved icon short codes. Until then, here's a self-contained minimal reproduction that showcases how to change attributes for social cards programmatically in on_page_markdown
for demo purposes:
Additionally, to work around the problem manually, you can use the following metadata in your page:
---
social:
cards_layout_options:
title: My page social card title
---
# My page title
Closing as resolved with configuration change.
from mkdocs-material.
Related Issues (20)
- Default value for search-plugin separator has a typo HOT 1
- Version selector is not displayed correctly after enabling showing version alias HOT 4
- Mermaid Viewer Control box? How can we use it? HOT 5
- Insiders tag plugin conflicts with markdown_extensions.toc HOT 5
- Section display text alias overridden with same .md files HOT 2
- Add tab index to `.md-search__scrollwrap` in the `search` plugin HOT 11
- [change(feature) request] Page Subtitle for Blog Posts HOT 3
- Annotation doesn't work inside markdown tables HOT 2
- Running "mkdocs serve" through Docker results in "Connection reset by peer" HOT 6
- Comment: The comment page must be refreshed to appear. HOT 4
- included in the 'nav' configuration, which is not found in the documentation files. HOT 1
- Blog issue - TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'NoneType' HOT 1
- Cannot use numbers as titles HOT 2
- Social cards: Using a custom background image HOT 2
- Table display “flickers” when refreshing the page HOT 9
- Version switcher fails to stay on the same page when `canonical_version` is set in mike HOT 3
- Allow ignoring some version aliases when showing the version selector HOT 6
- Blog: allow post author avatar to reference local files HOT 2
- Extra tabs in case content.tabs.link is enabled, get switched to another tab while scrolling. HOT 7
- Missing built-in typeset plugin on fresh install
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-material.