如何在HTML中隐藏特定图像

时间:2019-06-16 03:36:37

标签: html

我正在使用og:image元属性来定义图像,因此每当我在WhatsApp或Facebook中共享网页时,该图像都会显示为缩略图。

但是我所有的页面都有特定的图像。我想将这些图像显示为缩略图。所以我删除了meta标签。

2019-06-16T04:08:05.734012+00:00 app[web.1]: I, [2019-06-16T04:08:05.733918 #4] INFO -- : [..] Started PATCH "/shop_products/42" for 69.118.200.110 at 2019-06-16 04:08:05 +0000 2019-06-16T04:08:05.736086+00:00 app[web.1]: I, [2019-06-16T04:08:05.736010 #4] INFO -- : [..] Processing by ShopProductsController#update as HTML 2019-06-16T04:08:05.736353+00:00 app[web.1]: I, [2019-06-16T04:08:05.736280 #4] INFO -- : [..] Parameters: {....., "print_locations"=>{"1"=>{"shop_product_print_files_attributes"=>{"print_file"=>"a", "print_location_id"=>"1"}}, "2"=>{"shop_product_print_files_attributes"=>{"print_file"=>"a", "print_location_id"=>"2"}}, "3"=>{"shop_product_print_files_attributes"=>{"print_file"=>"b", "print_location_id"=>"3"}}, "4"=>{"shop_product_print_files_attributes"=>{"print_file"=>"", "print_location_id"=>"4"}}, "5"=>{"shop_product_print_files_attributes"=>{"print_file"=>"", "print_location_id"=>"5"}}, "6"=>{"shop_product_print_files_attributes"=>{"print_file"=>"", "print_location_id"=>"6"}}}, ......} 2019-06-16T04:08:05.741476+00:00 app[web.1]: D, [2019-06-16T04:08:05.741391 #4] DEBUG -- : [..] [1m[36mCart Load (2.2ms)[0m [1m[34mSELECT "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT $2[0m [["id", 20], ["LIMIT", 1]] 2019-06-16T04:08:05.745383+00:00 app[web.1]: D, [2019-06-16T04:08:05.745304 #4] DEBUG -- : [..] [1m[36mUser Load (3.0ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2[0m [["id", 1], ["LIMIT", 1]] 2019-06-16T04:08:05.751234+00:00 app[web.1]: D, [2019-06-16T04:08:05.750661 #4] DEBUG -- : [..] [1m[36mShopProduct Load (1.5ms)[0m [1m[34mSELECT "shop_products".* FROM "shop_products" WHERE "shop_products"."id" = $1 LIMIT $2[0m [["id", 42], ["LIMIT", 1]] 2019-06-16T04:08:05.756181+00:00 app[web.1]: D, [2019-06-16T04:08:05.756091 #4] DEBUG -- : [..] [1m[36mShopProduct Load (0.9ms)[0m [1m[34mSELECT "shop_products".* FROM "shop_products" WHERE "shop_products"."store_variant_id" = $1 LIMIT $2[0m [["store_variant_id", 15345629364273], ["LIMIT", 1]] 2019-06-16T04:08:05.759914+00:00 app[web.1]: D, [2019-06-16T04:08:05.759748 #4] DEBUG -- : [a1974bea-579d-42fe-b8aa-66a99314431e] [1m[36mProduct Load (0.9ms)[0m [1m[34mSELECT "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2[0m [["id", 3], ["LIMIT", 1]] 2019-06-16T04:08:05.762239+00:00 app[web.1]: D, [2019-06-16T04:08:05.762155 #4] DEBUG -- : [..] [1m[35m (0.7ms)[0m [1m[35mBEGIN[0m 2019-06-16T04:08:05.766104+00:00 app[web.1]: D, [2019-06-16T04:08:05.766013 #4] DEBUG -- : [a1974bea-579d-42fe-b8aa-66a99314431e] [1m[36mShopProduct Exists (0.9ms)[0m [1m[34mSELECT 1 AS one FROM "shop_products" WHERE "shop_products"."store_variant_id" = $1 AND "shop_products"."id" != $2 LIMIT $3[0m [["store_variant_id", 15345629364273], ["id", 42], ["LIMIT", 1]] 2019-06-16T04:08:05.768566+00:00 app[web.1]: D, [2019-06-16T04:08:05.768495 #4] DEBUG -- : [a1974bea-579d-42fe-b8aa-66a99314431e] [1m[35m (0.8ms)[0m [1m[35mCOMMIT[0m

但是我所有的页面都有2张图像。一个在顶部,另一个在页脚。由于页脚图像很大,因此每当我共享页面时,只有页脚图像会显示为缩略图。我想将顶部图像显示为缩略图。那么如何隐藏页脚图像?

1 个答案:

答案 0 :(得分:1)

您可以使用共享调试器来查看在Facebook,Messenger和其他地方共享您的网站内容时使用的信息。

https://developers.facebook.com/tools/debug/sharing/

它还将显示缺少的属性。

Open Graph Object Debugger也将为您提供帮助 https://developers.facebook.com/tools/debug/og/object/

如果您想进一步了解OGP,可以访问

http://ogp.me/