Let's say we have two pages in Orchard CMS. The homepage and the About US page. I want to use a RoyalSlider on the homepage which has its own CSS file. How do I include it only on the homepage and not on the about us page?
In Orchard CMS I am using Contoso as the theme and I tried including the royalslider.css file on the Layout.cshtml using Style.Include but this will include the CSS file over all the pages in the website which is not a good practice.
You should use URL Alternates feature for that. It's described here, in the section "URL and Widget Alternates".
After enabling the feature, copy the Layout.cshtml you found in your theme and rename it to Layout-url-homepage.cshtml. This one will only be used for rendering the homepage, so just add your Style.Include calls there and you're set.
You can try 2 things.
Use the Classy feature in Vandaley Industries module (http://gallery.orchardproject.net/List/Modules/Orchard.Module.Vandelay.Industries). Then you can add a script to any content type.
Create an alternate at the corresponding URL.
They are many other ways, as Orchard is SOOOO extensible. Try these two first. :)
Related
I've tried to generate an XML sitemap from different sites (XML-sitemaps, Seoutility, MrWebMaster) but they all create a one-page sitemap.
In other words, they can't find subdirectories into my website.
I've tried all www.mydomain.online, mydomain.online, https://mydomain.online, and https://www.mydomain.online URLs, but nothing changed.
I didn't implement URL rewriting, so my website structure is:
folder
|-----index.php
|-----something.inc.php
|-----subfolder1
|-----index.php
|-----somethingelse.inc.hp
|subfolder2
|-----index.php
|-----foo.inc.php
|-----bar.inc.php
|-----subfolder4
|-----index.php
|-----baz.inc.php
|subfolder3
|-----index.php
and so on...
The problem is that even Gooogle Search Console indexing system does only find one page into my website (and that's why I decided to build a sitemap).
Do I have to change something in my configuration or tell it to the generators in some ways to make them work?
My guesses:
your site's rendering is javascript-based and you use no technic to emulate urls,
your pages aren't linked with each other, beside of the startpage.
Without to see your site in natura it isn't possible to say more.
I run a website for my photography where I have a stories page (http://www.traumantic.com/stories.htm) that is a long list of choices that lead to a sub folder and a gallery of images for that session.
I have an index.htm file in each of those folders that displays the gallery chosen.
I am trying to develop a new format for my pages, and putting it in place means replacing dozens of index.htm files and editing each one for that new format. A boatload of work.
I have noted that a lot of news sites seems to have a method of using a single template for the main body of the page and the elements of the news story are pulled in from another source.
I figured I could do this with XML like I did with my galleries, but I am lost.
I tried creating an XML file in a couple of text folders and then reading that form an HTM file two levels up. Didn't work.
Currently when you click on a link on my stories page, it opens the index.htm file in a sub-folder.
What I want to happen is this.
Clicking on a choice on my stories page launches an html template that reads the details from the folder.
The one html template would be used for all of the different story folders below. Making it far easier to modify the look of my web site quickly.
I'd rather put a ton a of work into designing this system that doing a mass replace and edit project on hundreds of files.
I hope this makes sense to some of you and that you can guide me to some study topics that will help me learn how to do this.
I am seeking advice on places where I can see example of this process.
The simplest option is to use an iframe
https://www.w3schools.com/tags/tag_iframe.asp
<iframe src="/path/to/file.html"></iframe>
Searching "html include" will yield a few guides that have various JavaScript implementations. (e.g., https://www.w3schools.com/howto/howto_html_include.asp)
If you're able to run php, you could use include
https://www.w3schools.com/php/php_includes.asp
But at that point, you might want to consider installing some sort of template engine like twig https://twig.symfony.com/doc/2.x/intro.html
I have a blog site # google's blogger. Now I want to add my own styles in my pages. I have sufficient CSS knowledge to do this. But the problem is how do I save a css file, link it to my page and use in Google blogger it?
Note: I do not need to edit the blog template. I just need to add new styles to my page. E.G. : I need to create a code block by using codeBox class in my external style sheet file.
Sorry, but i don't think you actually can't, google Blogger uses their own GUI and its made for people who don't really know how to code (that's one of the purpose of blogs).
I recommend you to host your site either on GitHub or you could host your own site vía a custom host.
We are liferay 6.1.2. Have got 3 portlets on 3 different pages. We have our own set of JS files and CSS files which are self sufficient for the page to work. I see that there are lots of files loaded from /html/js and /html/css. How can we avoid loading these files. I am pretty sure that none of the rules from these CSS files are used in our page.
Liferay's pages bring a lot of functionality with them - e.g. the theme might provide libraries, other components on the page (like the dockbar) might use that functionality.
In the case of Liferay's core themes, they provide the AlloyUI library and your portlets can just assume that this library is available. If you don't need it, make sure there's no other portlet on the page that needs it as well (e.g. Dockbar, Chat, Notification portlet)
On the CSS side, Liferay loads quite a bit of CSS from the theme - bootstrap CSS among it all. Eliminate it and then try to get your layout back... It's typically all minified and combined into a single file anyway.
You can configure the files that get loaded for anonymous users and for logged in users in portal-ext.properties. Search for "barebone" and "everything" in the linked document. Also make sure that you haven't disabled the CSS- and JS-minifier. Disabling them is recommended during development. In production they should be enabled.
The best guideline I have seen for what should be in a theme is to put "functionality" in a plugin.
I am looking at adding more "premium features" like jQuery image sliders. This requires a back-end user interface for selecting featured content to slide. Is this presentation?
How about shortcodes? A shortcode is a simple hook that enables you to call a PHP function by adding something such as [shortcode] to a post or page. I see this in themes all the time. Is it presentation?
I am unable to sort it out!
Keep most of the heavy lifting in your functions.php file and you should be fine. But don't be afraid to add functionality to your other theme files since PHP and WordPress rely heavily on the integration of function and presentation.
The functions.php file of your theme is basically that theme's "plugins." There is really no difference between what you can do with functions.php and what you can do with a plugin.
Reasons to create a plugin instead of embedding it into the functions.php file include wanting re-usability in other themes, or if the Theme didn't necessarily depend on the functionality and disabling the plugin was something you wanted to have as an option.
Reasons to use the functions.php instead of plugins include your themes dependency on the functionality to aide the presentation in some manner and therefore the theme would look wrong without it.