I read this from a recent answer to a question:
After enabling the extension, just use {{ twitterfeed() }} in your templates.
But, what if I only want say a contact form on one page? Putting the tag in the page's text field doesn't work. And putting it in the template would have it available on all the pages using that template. Do I have to duplicate a template to use only for the contact page? If not where do I put the contact form tag?
I went to Bolt's extension page, selected "how to use extensions" from the menu, and got this message:
No proper name for a page in the docs. Bye!
Perhaps someone at Bolt could fix the URL?
I would like to know why none of the extensions I want to use are not working. I am clearly missing a vital piece of info.
Thank you.
After enabling the extension, just use {{ twitterfeed() }} in your templates.
The Twig function {{ twitterfeed() }} belongs (generally speaking) in a Twig template file. You can use Twig in record fields, but that requires setting allowtwig: true for that Contenttype field.
But, what if I only want say a contact form on one page?
There are a few ways to do this, but the easiest way is to make a copy of your sites template file for the page's Contenttype and select that template for the 'Contact' record. The default 'pages' Contenttype that comes with Bolt has a templateselect field type that enables this.
No proper name for a page in the docs. Bye!
Fixed! Thanks for pointing it out.
Related
Twig does a great job of sanitizing dangerous user input. However, I'm building a particular web app where I want to allow users to post clickable URL links in public comments. Is there some way I can make Twig not sanitize URL links, but still sanitize everything else?
You can use the raw filter to prevent HTML from being escaped:
{{ some_html|raw }}
Or maybe a better option would be to use it with the striptags filter and whitelist <a> tags:
{{ some_html|striptags('<a>')|raw }}
Internally, Twig uses the PHP strip_tags function. Note that its documentation has this warning:
Warning
This function does not modify any attributes on the tags that you allow using allowable_tags, including the style and onmouseover attributes that a mischievous user may abuse when posting text that will be shown to other users.
See TwigFiddle.
I use Orchard 1.10.1. I have a CustomContentType that has a "Group" Taxonomy field . In Content-CustomContentType.Detail.cshtml alternate, I want to have a link to a certain taxonomy term. this is my code:
<a href='???'>#Model.ContentItem.CustomContentType.Group.Terms[0].Name</a>
How can I get the url to replace this '???' in above code.
Thanks in advance.
You have a few options available to you. I've just typed them all straight into the browser and Orchard is a tricky beast to navigate its model so if they blow up in your face let me know and I'll dig a bit deeper :)
Let orchard make the entire link
Looking at the TaxonomyItemLink.cshtml file you can see that you can display the link like this:
#using Orchard.Taxonomies.Models
#{
TermPart part = Model.ContentPart;
}
#Html.ItemDisplayLink(part)
So in your case you could use:
#Html.ItemDisplayLink((ContentPart)Model.ContentItem.CustomContentType.Group.Terms[0])
Just get the URL
You can use #Url.ItemDisplayUrl() to turn a routable content item into a url.
<a href="#Url.ItemDisplayUrl((ContentPart)Model.ContentItem.CustomContentType.Group.Terms[0])">
#Model.ContentItem.CustomContentType.Group.Terms[0].Name
</a>
Because it's an extension method you can't pass a dynamic so you will need to cast the type. This is why the (ContentPart) is there.
Just get the Slug
Actually, in this case the TermsPart class already has a .Slug property on it, so this might also work:
<a href="#Model.ContentItem.CustomContentType.Group.Terms[0].Slug">
#Model.ContentItem.CustomContentType.Group.Terms[0].Name
</a>
I'm not sure if the slug just contains the end bit or its full url though.
I have a tag cloud on product listing pages on my site that goes to a tag results page which displays products that contain that chosen tag. I want to put a header at the top of that results page that says something like "Products Tagged As: (insert tag name here)"
Any advice? I can't seem to access the system variable that displays the currently chosen tag name. The page URL contains the tagID variable, if that helps:
Product-Features.aspx?tagid=36
I am using Portal Engine Kentico development, by the way. Thanks.
I know this question has been asked a while ago. But I am posting my answer just in case if anyone come across this question they can use this snippet.
Try using following macro
{%tag="";foreach(g IN SiteObjects.TagGroups){foreach(t IN g.Tags){if(t.TagID=ToInt(QueryString.tagid)){tag=t.TagName;}}}return tag;%}
Note: I am using Kentico Version 9.0
For some reason the macro doesnt work in page template directly, I put the above macro in a Static Text webpart its worked like a charm.
Hope it would help someone like myself.
Regards,
Gopala
Use following macro:
{% GlobalObjects.Tags.Where("TagID = " + ToInt(QueryString.GetValue("tagid", 0))) %}
Looking to remove the Url field on a blog in orchard.comments modal. The problem is that the URL get linked to the username and i do not want my site linking to explicit sites or other content. I have tried display:none on the css but it would not take a genius just to display:block it.
Thanks in advance.
Edit the content type and disable Allow custom patterns in the autoroute section.
Of you just dont want to display the field, download Designer Tools and use Shape Tracing to generate the view and then customize it as you need.
I need to create meta tags for the seo of my website.
I am using WHMCS and a custom template
Any page is compiled through the header.tpl, footer.php page1.tpl and page1.php pages
What I tried was to add
">
to header.tpl which does add the line of code to the "output source"
and I added
$pgDesc = 'Any custom description';
to the page1.php
Somehow the echo $pgDesc does not call the value correct
Any ideas ?
Just add your metatags to header.tpl. And that's all. You can get your title/desctiption/keywords strings from various sources: whmcs variables, translation strings, and even some db.
See http://docs.whmcs.com/Seo