ngGallery icon indicating copy to clipboard operation
ngGallery copied to clipboard

Possible to open model without ng-gallery

Open iBasit opened this issue 9 years ago • 5 comments

I want to support search engines to get the images from the site, but using ng-gallery will prevent me doing so.

So I want to implement normal loop of images using img tag and then use javascript (angular) function to open that image in model box and other images to follow on model as gallery images.

Is it possible?

iBasit avatar Jan 19 '16 00:01 iBasit

That's a good point. Is there (or is it planned) an official way to work with html in order to allow search engines to crawl the images?

bogomips avatar Apr 10 '16 23:04 bogomips

Can you please check the "ngGalleryFromHtmlImages" branch?

Usage example: https://rawgit.bessei-it.eu/SchwarzwaldFalke/ngGallery/ngGalleryFromHtmlImages/examples/imagesFromHtml/index.html

Important: You still need an array inside your scope for the images. Just leave it empty if you add all your images via HTML images.

SchwarzwaldFalke avatar Apr 16 '16 19:04 SchwarzwaldFalke

I needed to quickly overcome the problem so I cheated a bit inserting a php for cycle that prints tags inside the tag. When js starts immediately overwrite those html produced by php. It is a dirty way and it could have side effects becouse search engines (google) execute js. Now there is an ufficial way and I am glad about that! I will check it out soon and convert my code. thanks

bogomips avatar Apr 16 '16 22:04 bogomips

Hi! I'm not sure if the current solution will help you: It also expects img tags inside the ng-gallery directive and replaces them (as soon as angularJS starts) with the "real" ngGallery html. I don't think the solution has SEO side effects because there are always img tags (Without JS the php generated html and with JS the ngGallery generated html).

Nonetheless: I don't like the current solution. It works but it's kind of ugly. If you have a better idea, I'm all ears. :)

SchwarzwaldFalke avatar Apr 16 '16 22:04 SchwarzwaldFalke

@SchwarzwaldFalke Just so you know, what I have done is

scope: {
    controls: '=',
    images: '=',
    thumbsNum: '@'
},

I have added a controls model for this functionality. Using this like below

//Launch ngGallery remotely
scope.controls = scope.controls || {};
scope.controls.launch = function(index){
    var i = index || 0;
    scope.openGallery(i);
}

Likewise, any operation can be done from outside using controls model. (close, next, prev etc).

P.S. Using css, you have set .ng-gallery to display:none

thatisuday avatar Apr 27 '16 12:04 thatisuday