Make meta tag with reagent - clojurescript

I want to render a meta tag with Reagent.
I can not find any info with Google.
[:div
(header #company-name)]
Looks like it outputs everything into body. How to write meta tags?

If you want to render something into <head> you should do it as usual with any Reagent UI code.
(reagent.core/render [header] (.-head js/document))
The above will render into <head>.
There's also NPM package that allows rendering into <head> from within your app's UI tree react-helmet.

Related

is there a difference between using built in Head component from nextjs and head tag from as jsx

I hope that this question is suitable for this comunity.
I am confused on how build in Head component in nextjs work.
My guess is that as a default nextjs creates metadata and Head replaces or add to it. However I am not sure what would happen if I create my own metadata not with buildIn Head but with a custom meta component like this:
<html len= {leng || "en"}>
<head>
///some data
</head>
I guess it doesn't really matter but I want to learn the the need for a buildIn Head component.
also I want to be able to change language of the page and It seems easier with my custom component?
If you use regular <head> tag it will just print it as is. In the root level Layout component, such as in your example, it won't matter. But Next's component will help when you want to set <head> from sub components, so basically it will act like a reference for the head element in the page. You can read about other features of it in the docs.

Why do we need <h:body> in JSF

Is there any especial purpose of <h:body>? <body> is not enough while making JSF application?
From the documentation
This tag renders an HTML body element. It also provides a target for JSF resource relocation. This enables JSF developers to implement components that have dependencies on resources such as images, scripts, and cascading stylesheets in a more flexible way by telling the JSF framework where to render these resources at request time. The usual targets are the "head" or "body" tags. Relocatable resources are especially useful when implementing JSF2 composite components.
And this
Render the starting element tag. Just before rendering the closing element tag, render any resources that have been targeted for this "body" element:
Obtain a UIViewRoot instance.
Obtain a List of component resources targeted for this "body" element with a call to UIViewRoot.getComponentResources() with the String "body" as the argument. Render the ending element tag.
Iterate over the returned List of UIComponent instances and call encodeAll on each UIComponent instance.
So, I guess the key is in providing resources that JSF framework uses.
The first quote says that the usual targets are the "head" or "body" tags. If, for example, in <h:body> tag you have <h:outputScript name="hello.js"/>, this will render the script in <body> tag, but this can be changed to <head> if you specify so in target attribute. This is Resource Relocation, and can be found explained in more details here.

How to add Blogger <data:> tags inside meta tags in HTML

Well I have a Blogger template tag which looks like this <data:post.title/> which serves the post title directly via the server and I wish to include this as the meta description for which I tried it something like this
<meta name='description' content='<data:post.title/>' />
but this fails because of XML and XHTML platform. I thought of using PHP to render the same but the platform(Blogger Blogspot) doesn't support PHP either and obviously usage of scripts is a big no no considering crawlers won't crawl them. Now I need a solution to add these to the template dynamically using the data tag and also should be crawlable.
Note: Manually adding meta tags for each post is a big no no considering how much lengthier it will get inside the html template besides that it's not productive at all for 1000's of posts besides that everything is there the data tag and all I need is a way to include it inside the meta tag. Many many thanks in Advance.
Try
<meta name='description' content='data:post.title' />
I figured out how to convert the code into XHTML, All it needs is a parsing declaration which I found while reading about meta tags in this article.
<meta name='description' expr:content='data:post.title' />

HTML/Unicode character and specifically the checkmark character in .resx files are not rendered correctly in HTML?

I'm trying to get checkmarks in my metadata description. Since my site is multilanguage, I add descriptions as follows
<%# Page MetaDescription="<%$Resources:metadescription%>
When I add these codes checkmark codes (http://www.fileformat.info/info/unicode/char/2713/index.htm)
✓
or
✓
or as someone already suggested:
✔
In my Visual Studio 2012 resource file (default.aspx.resx), they are rendered as the exact code and not as a checkmark as I would expect. How can I render the checkmark to the HTML and not the code?
I added this line to my masterpage:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
When I enter this code directly in the HTML:
✔
so in default.aspx, the checkmark is rendered correctly!
when I replace
<%# Page MetaDescription="<%$Resources:metadescription%>"
with
<%# Page MetaDescription="<%=$Resources:metadescription%>"
I just get this in my HTML:
<meta name="description" content="<%=$Resources:metadescription%>" />
There seems to be something going wrong with HTML codes in the resource files, but how to fix it?
So you just see
<meta name="description" content="… ✔ …" />
in the resulting markup and you would like to see
<meta name="description" content="… ✔ …" />
instead.
First, I want to point out, that any user agent should decode the ✔ entity to ✔ when reading the content atribute. See attributes in HTML spec. Therefore what you want is really a cosmetic change with virtually no technical impact.
If you want to get the latter markup (with ✔), just include the ✔ in your resource file. You could copy & paste it from
the Fileformat.info page where it is rendered under string.toUpperCase() in Java Data section or from
the page rendered when you put javascript:'✔' into your browser’s location bar.
Alternatively you could input it directly using and input method. E.g. on Windows you could type Alt+2,7,1,4 (described on Fileformat.info too). For more practical info on input methods of various operating systems see fsymbols.com.
How do you include the resource text in the HTML? Are you assigning the value to a label? Do you write it directly to the page? ASP.NET will auto-html-encode the value for a subset of the controls.
The following list of controls do not HTML encode the value you assign. All other controls will auto encode. If you need to show the value in an auto-encoding control, you need to put the raw unicode value in your Resource file, instead of the HTML-encoded version.
To add your unicode text to the resx file you can use ALT+1+0+0+0+3 on the num-pad to insert the character. Or you can copy paste it directly into the editor from any web page or word document or the character map in Windows.
Or to make <% %> not auto-encode your HTML content, use <%= %>.

What is the attribute property="og:title" inside meta tag?

I have this extract of website source code:
<meta content="This is a basic text" property="og:title" />
What does this property attribute stand for, and what is its purpose?
og:title is one of the open graph meta tags. og:... properties define objects in a social graph. They are used for example by Facebook.
og:title stands for the title of your object as it should appear within the graph (see here for more http://ogp.me/ )
The property in meta tags allows you to specify values to property fields which come from a property library. The property library (RDFa format) is specified in the head tag.
For example, to use that code you would have to have something like this in your <head tag. <head xmlns:og="http://example.org/"> and inside the http://example.org/ there would be a specification for title (og:title).
The tag from your example was almost definitely from the Open Graph Protocol, the purpose is to specify structured information about your website for the use of Facebook (and possibly other search engines).
A degree of control is possible over how information travels from a third-party website to Facebook when a page is shared (or liked, etc.). In order to make this possible, information is sent via Open Graph meta tags in the <head> part of the website’s code.
Probably part of Open Graph Protocol for Facebook.
Edit: guess not only Facebook - that's only one example of using it.