How to add HTML file head tags in my custom plugin?
-
<head>
<title>Leaflet Provider Demo</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Leaflet style. REQUIRED! -->
<link rel="stylesheet" href="http://unpkg.com/[email protected]/dist/leaflet.css" />
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0;}
.map { height: 100% }
</style>
</head>This is what I want that the NodeBB should emit when it parses a custom .tpl and generates a HTML file? What shall I write in the .tpl? Or do I need to write it somewhere else?
Thanks
-
Use the
filter:meta.getLinkTags
hook:nodebb-plugin-emoji/lib/index.ts at master · NodeBB/nodebb-plugin-emoji
NodeBB Plugin enabling emoji as seen on http://www.emoji-cheat-sheet.com - nodebb-plugin-emoji/lib/index.ts at master · NodeBB/nodebb-plugin-emoji
GitHub (github.com)
-
I am sorry I didn't understand it. Could you pl. write a piece of code including the plugin.json that handles these two requirements:
a. Ability to generate the <head> tag content
b. Ability to include the leaflet.js, leaflet-providers.js, and leaflet.css files residing in my local directoryThank you very much for putting me on the track.
What is this link for: https://github.com/NodeBB/nodebb-plugin-emoji/blob/master/lib/index.ts#L80
Since I have been using the Leaflet which is a third-party module, isn't there any need to use the "modules" property in my plugin.json?
-
If you want to not include the actual head tags and instead have the scripts be included in the JS / CSS Bundles, you can put them in the
scripts
andcss
arrays in plugin.json -
I got to understand what meta.getLinkTags is all about. But there is no hook something like meta.getStyleTags that generates this style tag inside the head tag.
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0;}
.map { height: 100% }
</style>How to generate this one?
Thanks
-
Or you could just add a less file in your plugin and add it to the
less
array in plugin.json