Pattern Lab: changing the title - html

The title is currently 'Pattern Lab' and I can't seem to change it. I've tried changing it in '_00-head.mustache' and also in '_data.json' but neither works.

You can change the title in this file:
./core/templates/index.mustache
You will need to generate the ./public after using the PHP cmd:
php core/builder.php

Related

Making User Variable From config.toml Show Up In Page Body

I'm creating a page. I have a site-wide parameter defined in my default config.toml file like this.
[Params]
tdName= "Mr. Tournament Director"
In my page I'm writing:
{{ .Site.Params.tdName }}
Rather than the string in quotes, the code below that is litterally showing up when I run the "hugo server" command. What am I doing wrong?
Thanks.
Another option is to use Hugo's built-in param shortcode like this:
{{< param tdName >}}
To learn about this built-in shortcode, see:
https://gohugo.io/content-management/shortcodes/#param
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/param.html
To specify Go template code in a file in the content directory, you need to use a Hugo shortcode. For example, you could use this inline shortcode:
{{< tdname.inline >}}
{{ site.Params.tdName }}
{{< /tdname.inline >}}
To use inline shortcodes, as I do above, you need to set enableInlineShortcodes to true in your config file.
Note that:
site.Params.tdName is usually equivalent to .Site.Params.tdName but is better because it is context free (no leading dot (.))
Hugo has some weird case sensitivity issues so I recommend that you change tdName to td_name or tdname or something without upper case characters.

Remove inline styles from django-tinymce html content

When I save content through django-tinymce it adds its own inline styles. However I'd like to remove this behaviour and just save the content in plain html. Can you please help me on this issue?
You can use any of tinyMCE configs like this:
Put this to your Django settings.py
(this will tell tinyMCE which elements are allowed`)
DJANGO settings.py
TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'valid_elements' : 'a[href|target=_blank],strong/b,div[align],br,p'
}
And push Clean Button in TinyMCE.
All TinyMCE configs is here:
Try also look at invalid_elements and invalid_styles
P.S. It would have more sense to set:
'invalid_elements': 'p[styles], span'
to remove all styles But It didn't work.
Hope it helps.
You could try writing your own implementation of a save function using
getContent({format: 'text'})
I'm no Djanjo expert but it sounds like the problem is being caused by them, and not TinyMCE itself.

Wordpress visual editor not making line breaks

This should be very simple, i can not believe that a company the size of Wordpress cannot provide users a very simple way to make line breaks.
I know how to use the text tab and code the page using html (im a developer). However my clients have absolutely no idea what html is so they obviously can not use it.
All the client wants to do is make a "space between lines" , in our terms a break line. They only want to use the visual editor.
Now when they start typing and hit enter, it creates & nbsp; or closes a paragraph tag.
Many articles are saying that shift + enter will make one, however this 100% does not as ive tried.
Ive tried a plugin that most articles are suggesting called "tinymce advanced". But this does not resolve the problem.
Is there any way possible for a normal user with no html knowledge to only use the visual editor and create br lines without actually using code?
Holding down Shift+Enter definitely works.
Alternatively, you can always prevent Wordpress from automatically adding <p> tags to the markup using the following code inside of your theme's functions.php file:
remove_filter('the_content', 'wpautop');
I had this problem on my site, it began when I updated the theme, which had not been updated for years.
The "miraculous" solution was to update
all the plugins as well.
I have realized that the
<br / > and the < p >
symbols are not present in the wp editor in text mode
So there must be a conversion between \n (newline) and <br / > and < p > taking place, I have not investigated this further, but maybe somebody can explain how WordPress is working.
With the WordPress upgrade to version 3.2, the text editor seems to remove the line break by itself.
Add a filter in the functions.php file which adds a clear attribute to the <br/> tag. When the attribute is added, the <br/> tag is not removed by WordPress.
function clear_br($content){
return str_replace("<br/>","<br clear='none'/>", $content);
}
add_filter('the_content','clear_br');
Then apply this filter on a variable where you need break should come in that text content
$specification = apply_filters( 'the_content', $specification );
For more info: https://blog.templatetoaster.com/wordpress-line-break-not-working/
This small code fixed my issue.
echo nl2br(category_description( the_content);
Just replace the content tag with this in you file

Disable auto-adding of <p> tag

I'm trying to remove auto-adding of <p> tag in CQ5(Version 5.6.0.20130125). I've tried to add these properties to the text component I'm using but with no effect.(source)
removeSingleParagraphContainer true
singeParagraphContainerReplacement (empty string)
I've also tried this solution. Again, no effect.
Is it possible to disable auto-adding of <p> tag?
Thanks for any ideas
EDIT I've tried this answer but CQ still adds <p> tags to my code. For example, I have this HTML code
<strong>Headquarters:</strong>
<p>MY - COMPANY a.s.<br>
Random Street 77<br>
Random City</p>
and after I submit it, the code changes to
<p><strong>Headquarters:</strong></p>
<p>MY - COMPANY a.s.<br>
Random Street 77<br>
Random City</p>
my RTE looks like this
<text jcr:primaryType="cq:widget"
hideLabel="{Boolean}true"
name="./text"
xtype="richtext">
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
...
</docType>
<blockHandling
jcr:primaryType="nt:unstructured"
removeSingleParagraphContainer="{Boolean}true"/>
</htmlRules>
</text>
EDIT2 this is what my hierarchy looks like
You can keep the RTE from surrounding your text with <p> tags by setting the removeSingleParagraphContainer property to true as long as you only create one paragraph.
With Chrome on Mac OS X (at least), holding shift while pressing enter inserts line breaks instead of paragraph breaks so you can still create text with multiple lines. Since you said in your last question that you're using the misctools plugin, you can use the source edit view to peek at the markup as you go.
Finally, to set the removeSingleParagraphContainer property, you'll need to create another child called blockHandling under your htmlRules node in your dialog. You don't need to mess with singeParagraphContainerReplacement property, but if you did, you would set it on the same node:
<rtePlugins jcr:primaryType="nt:unstructured">
...
</rtePlugins>
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
...
</docType>
<blockHandling
jcr:primaryType="nt:unstructured"
removeSingleParagraphContainer="{Boolean}true"/>
</htmlRules>
Edit regarding your edit: using the source edit feature of the misctools plugin and pasting this exact text saves and loads without p tags for me in Chrome on Mac OS X:
<strong>Headquarters:</strong><br>
MY - COMPANY a.s.<br>
Random Street 77<br>
Random City
Are you sure your dialog.xml deployed properly? Maybe double-check that your component's dialog hierarchy looks how you'd expect it to in CRXDE Lite:
The property removeSingleParagraphContainer should be added in node with xtype is richtext.
Example:
<text jcr:primaryType="cq:Widget"
hideLabel="{Boolean}true"
name="./text"
height="{Long}520"
removeSingleParagraphContainer="{Boolean}true"
xtype="richtext">
CRXDE Lite: configuration in crxde lite
Note: And this configuration is only used for single paragraph.
Refer: more info about removeSingleParagraphContainer
Try using #context='html' in your code. This lets you set the context of the text as html so even if there are tags in your dialog value, they will be rendered as equivalent html and not as tag on the page.
eg :
{properties.something #context='html'}
For Touch UI, you can also create a custom paraformat option in the AEM Touch UI, cq/gui/components/authoring/dialog/richtext, and then using Java Backend, Sling Model, to text-transform the output, so that your Sightly HTL can render the output Html as expected. For the full tutorial, you can find it here.
https://sourcedcode.com/blog/aem/aem-richtext-remove-p-tag-removesingleparagraphcontainer-for-touch-ui
Try using #context='unsafe' in your code. You should be able to get rid of the unnecessary HTML tags, worked for me

How to prevent ░ or ▀ changing to &#9617,etc?

i am trying to add this in source code of my page inside a comment.
However,when i save,the characters change from this http://img.ctrlv.in/5134b28e330fa.jpg
to
http://img.ctrlv.in/5134b28e7a5b0.jpg
i tried encoding the characters,but in vain.They still change.
Is there any trick to prevent them from changing?thanks a lot
No.
You are at the mercy of Blogger's template processor.